summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
Commit message (Collapse)AuthorAgeFilesLines
* Conditionalize result of a bytecomp testGlenn Morris2019-07-091-0/+1
| | | | | | * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test--switch-duplicates): Apparently the result depends on byte-compile-cond-use-jump-table.
* Add tests for text-property-search to check prop-match-valueStefan Kangas2019-07-061-0/+43
| | | | | | | | | | | | | * test/lisp/emacs-lisp/text-property-search-tests.el (with-match-test): New macro. (text-property-search-forward-prop-match-match-face-nil-nil) (text-property-search-forward-prop-match-match-face-bold-t) (text-property-search-forward-prop-match-match-face-bold-nil) (text-property-search-backward-prop-match-match-face-nil-nil) (text-property-search-backward-prop-match-match-face-italic-t) (text-property-search-backward-prop-match-match-face-italic-nil): Add test cases to also verify the value of prop-match-value (bug#36486).
* Optimise more inputs to `regexp-opt' (bug#36444)Mattias Engdegård2019-07-041-1/+61
| | | | | | | | | | | | | | | | | Use a more precise test to determine whether the input to `regexp-opt' is safe to optimise when KEEP-ORDER is non-nil, permitting more inputs to be optimised than before. For example, ("good" "goal" "go") is now accepted. * lisp/emacs-lisp/regexp-opt.el (regexp-opt): More precise test for whether the list is safe w.r.t. KEEP-ORDER. (regexp-opt--contains-prefix): Remove. * test/lisp/emacs-lisp/regexp-opt-tests.el: Use lexical-binding. (regexp-opt-test--permutation, regexp-opt-test--factorial) (regexp-opt-test--permutations, regexp-opt-test--match-all) (regexp-opt-test--check-perm, regexp-opt-test--explain-perm) (regexp-opt-keep-order): Test KEEP-ORDER.
* Allow empty argument to `regexp-opt-charset'Mattias Engdegård2019-06-291-5/+24
| | | | | | * test/lisp/emacs-lisp/regexp-opt-tests.el (regexp-opt-charset): Handle nil argument, and use regexp-quote for singletons. * lisp/emacs-lisp/regexp-opt.el (regexp-opt-charset): Expand tests.
* Fix (rx-to-string (and (literal STR) (regexp STR)) regressionNoam Postavsky2019-06-261-0/+4
| | | | | | * lisp/emacs-lisp/rx.el (rx-regexp, rx-literal): Check the cadr of the form for stringness, not the form itself. * test/lisp/emacs-lisp/rx-tests.el (rx-to-string-lisp-forms): New test.
* Support (rx (and (regexp EXPR) (literal EXPR))) (Bug#36237)Noam Postavsky2019-06-251-0/+41
| | | | | | | | | | | | | | | | | * lisp/emacs-lisp/rx.el (rx-regexp): Allow non-string forms. (rx-constituents): Add literal constituent, which is like a plain STRING form, but allows arbitrary lisp expressions. (rx-literal): New function. (rx-compile-to-lisp): New variable. (rx--subforms): New helper function for handling subforms, including non-constant case. (rx-group-if, rx-and, rx-or, rx-=, rx->=, rx-repeat, rx-submatch) (rx-submatch-n, rx-kleene, rx-atomic-p): Use it to handle non-constant subforms. (rx): Document new form, wrap non-constant forms with concat call. * test/lisp/emacs-lisp/rx-tests.el (rx-tests--match): New macro. (rx-nonstring-expr, rx-nonstring-expr-non-greedy): New tests. * etc/NEWS: Announce changes.
* Compile any subsequence of `cond' clauses to switch (bug#36139)Mattias Engdegård2019-06-191-1/+14
| | | | | | | | | | | | | | | | | | | | A single `cond' form can how be compiled to any number of switch ops, optionally interspersed with non-switch conditions. Previously, switch ops would only be used for whole `cond' forms containing no other tests. * lisp/emacs-lisp/bytecomp.el (byte-compile--cond-vars): Rename from `byte-compile-cond-vars'. (byte-compile--default-val): Remove. (byte-compile--cond-switch-prefix): Replace `byte-compile-cond-jump-table-info'; now also returns trailing non-switch clauses. (byte-compile-cond-jump-table): New arguments; no longer compiles the default case. (byte-compile-cond): Look for and compile switches at any place in the list of clauses. * test/lisp/emacs-lisp/bytecomp-tests.el (byte-opt-testsuite-arith-data): Add test expression.
* Compile cond with heterogeneous tests into switch (bug#36139)Mattias Engdegård2019-06-191-1/+24
| | | | | | | | | | Allow any mixture of `eq', `eql' and `equal', `memq', `memql' and `member' in a switch-like `cond' to be compiled into a single switch. * lisp/emacs-lisp/bytecomp.el (byte-compile--common-test): New. (byte-compile-cond-jump-table-info): Use most specific common test. * test/lisp/emacs-lisp/bytecomp-tests.el (byte-opt-testsuite-arith-data): Add test cases for multi-value clause cond forms.
* Tighter pcase or-pattern member function selection (bug#36139)Mattias Engdegård2019-06-191-2/+4
| | | | | | | | | * lisp/emacs-lisp/pcase.el (pcase--u1): Use the most specific of `memq', `memql' and `member' in or-patterns with constant cases. This improves performance and may help the byte-code compiler generate a switch. * test/lisp/emacs-lisp/pcase-tests.el (pcase-tests-member): Add mixed-type or-pattern test cases.
* Disable filling of warnings in a bytecomp testGlenn Morris2019-06-161-1/+2
| | | | | * test/lisp/emacs-lisp/bytecomp-tests.el (test-suppression): Disable filling rather than working around it.
* Also test unpackingLars Ingebrigtsen2019-06-151-0/+26
|
* Refactor for reuseLars Ingebrigtsen2019-06-151-28/+31
|
* New file to test bindat functionsLars Ingebrigtsen2019-06-151-0/+70
|
* Allow for line breaks in a bytecomp testGlenn Morris2019-06-121-0/+1
| | | | | * test/lisp/emacs-lisp/bytecomp-tests.el (test-suppression): Warnings from the byte compiler may be filled.
* Give more information in a bytecomp test failureGlenn Morris2019-06-121-2/+2
| | | | | * test/lisp/emacs-lisp/bytecomp-tests.el (test-suppression): More informative failure messages.
* Add the new macro with-suppressed-warningsLars Ingebrigtsen2019-06-121-0/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/byte-run.el (with-suppressed-warnings): New macro. * doc/lispref/compile.texi (Compiler Errors): Document with-suppressed-warnings and deemphasise with-no-warnings slightly. * lisp/emacs-lisp/bytecomp.el (byte-compile--suppressed-warnings): New internal variable. (byte-compile-warning-enabled-p): Heed byte-compile--suppressed-warnings, bound via with-suppressed-warnings. (byte-compile-initial-macro-environment): Provide a macro expansion of with-suppressed-warnings. (byte-compile-file-form-with-suppressed-warnings): New byte hunk handler for the suppressed symbol machinery. (byte-compile-suppressed-warnings): Ditto for the byteop. (byte-compile-file-form-defmumble): Ditto. (byte-compile-form, byte-compile-normal-call) (byte-compile-normal-call, byte-compile-variable-ref) (byte-compile-set-default, byte-compile-variable-set) (byte-compile-function-form, byte-compile-set-default) (byte-compile-warn-obsolete, byte-compile--declare-var): Pass the symbol being warned in to byte-compile-warning-enabled-p. * test/lisp/emacs-lisp/bytecomp-tests.el (test-suppression): New function. (bytecomp-test--with-suppressed-warnings): Tests.
* Don't keep warning about unescaped literals (Bug#36068)Noam Postavsky2019-06-101-13/+19
| | | | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Restore lost let-binding of lread--unescaped-character-literals, so that unescaped literals warning will only apply to the form just read. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--unescaped-char-literals): Expand test to check that we don't keep warning about old unescaped literals.
* Fix `cl-member' and `cl-assoc' for bignumsMattias Engdegård2019-06-011-0/+8
| | | | | * lisp/emacs-lisp/cl-seq.el (cl-member, cl-assoc): Work with bignums. * test/lisp/emacs-lisp/cl-seq-tests.el (cl-seq-bignum-eql): New.
* Merge from origin/emacs-26Glenn Morris2019-06-012-6/+36
|\ | | | | | | | | | | 134edc1 Warn about wrong number of args for subrs (Bug#35767) 5f01af6 Use plain symbols for eieio type descriptors (Bug#29220) 4b24b01 Pacify GCC 9 -Wredundant-decls
| * Warn about wrong number of args for subrs (Bug#35767)Noam Postavsky2019-05-301-0/+14
| | | | | | | | | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-callargs-warn): Don't assume byte-compile-fdefinition will return non-nil. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-warn-wrong-args) (bytecomp-warn-wrong-args-subr): New tests.
| * Use plain symbols for eieio type descriptors (Bug#29220)Noam Postavsky2019-05-301-6/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since Emacs 26, eieio objects use a class record (with circular references) as the type descriptor of the object record. This causes problems when reading back an object from a string, because the class record is not `eq' to the canonical one (which means that read objects don't satisfy the foo-p predicate). * lisp/emacs-lisp/eieio.el (make-instance): As a (partial) fix, set the record's type descriptor to a plain symbol for the type descriptor when eieio-backward-compatibility is non-nil (the default). * lisp/emacs-lisp/eieio-core.el (eieio--object-class): Call eieio--class-object on the type tag when eieio-backward-compatibility is non-nil. (eieio-object-p): Use eieio--object-class instead of eieio--object-class-tag. * test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el (eieio-test-persist-hash-and-vector) (eieio-test-persist-interior-lists): Make into functions. (eieio-persist-hash-and-vector-backward-compatibility) (eieio-persist-hash-and-vector-no-backward-compatibility) (eieio-test-persist-interior-lists-backward-compatibility) (eieio-test-persist-interior-lists-no-backward-compatibility): New tests which call them, eieio-backward-compatibility let-bound.
* | Correctly eliminate duplicate cases in switch compilationMattias Engdegård2019-05-271-1/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix code mistakes that prevented the correct elimination of duplicated cases when compiling a `cond' form to a switch bytecode, as in (cond ((eq x 'a) 1) ((eq x 'b) 2) ((eq x 'a) 3) ; should be elided ((eq x 'c) 4)) Sometimes, this caused the bytecode to use the wrong branch (bug#35770). * lisp/emacs-lisp/bytecomp.el (byte-compile-cond-vars): Return obj2 eval'ed. (byte-compile-cond-jump-table-info): Discard redundant condition. Use `obj2' as evaluated. Discard duplicated cases instead of failing the table generation. * test/lisp/emacs-lisp/bytecomp-tests.el (toplevel): Require subr-x. (byte-opt-testsuite-arith-data, bytecomp-test--switch-duplicates): Test.
* | ; Fix read-multiple-choice testNoam Postavsky2019-05-261-1/+1
| | | | | | | | | | | | * test/lisp/emacs-lisp/rmc-tests.el (test-read-multiple-choice): Rebind read-event, read-multiple-choice uses that since 2019-05-26 "Avoid infloop in read-multiple-choice (Bug#32257)".
* | Update author/maintainer infoPaul Eggert2019-05-261-1/+1
| | | | | | | | | | Update email addresses and fix spellings of some author and maintainer names.
* | Go back to "Maintainer: emacs-devel@gnu.org"Paul Eggert2019-05-253-0/+3
| | | | | | | | | | | | Restore lines saying "Maintainer: emacs-devel@gnu.org" when there is no special maintainer for a file. Although this wasn't documented it was common practice and removing the lines didn't have consensus.
* | Allow zero-argument rx `or' and `seq' formsMattias Engdegård2019-05-201-1/+7
| | | | | | | | | | | | | | | | | | | | | | Make the rx `or' and `seq' forms accept zero arguments to produce a never-matching regexp and an empty string, respectively. * lisp/emacs-lisp/rx.el: Require cl-extra. (rx-constituents, rx-or): Permit zero args. (rx): Amend doc string for `or' and `seq'. * test/lisp/emacs-lisp/rx-tests.el (rx-or, rx-seq): Test the change. * etc/NEWS (Changes in Specialized Modes and Packages): Mention the change.
* | Revert "Allow zero-argument rx `or' and `seq' forms"Mattias Engdegård2019-05-201-7/+1
| | | | | | | | | | This reverts commit b552fc05c231ca6800330a318d3a74ddd0f5a13c. It caused a bootstrapping failure which I have yet to resolve - sorry.
* | Allow zero-argument rx `or' and `seq' formsMattias Engdegård2019-05-201-1/+7
| | | | | | | | | | | | | | | | | | | | Make the rx `or' and `seq' forms accept zero arguments to produce a never-matching regexp and an empty string, respectively. * lisp/emacs-lisp/rx.el (rx-constituents, rx-or): Permit zero args. (rx): Amend doc string for `or' and `seq'. * test/lisp/emacs-lisp/rx-tests.el (rx-or, rx-seq): Test the change. * etc/NEWS (Changes in Specialized Modes and Packages): Mention the change.
* | Fixes for "Maintainer:" and related linesPaul Eggert2019-05-193-3/+0
| | | | | | | | | | | | Mostly, this just removes "Maintainer: emacs-devel@gnu.org" lines, which are not that useful. It also cleans up and regularizes a few similar lines.
* | * cl-macs-tests.el (cl-macs-test--symbol-macrolet): New testStefan Monnier2019-05-161-0/+17
| |
* | Merge from origin/emacs-26Glenn Morris2019-05-081-2/+54
|\| | | | | | | | | | | | | | | | | | | 1c6484e (origin/emacs-26) Fix incorrect cloning of eieio-instance-inh... 37436fe Fix cloning of eieio-named objects (Bug#22840) fb65a36 Fix ibuffer-unmark-backward synopsis (bug#35572) f77bd2b ; * src/lisp.h (DEFSYM): Fix inaccurate comment. 3b86e0b Clarify handling of long options (Bug#24949) 04340a8 Improve documentation of the daemon and emacsclient 3e29de2 * etc/NEWS.24: Belatedly announce delete-consecutive-dups.
| * Fix incorrect cloning of eieio-instance-inheritor objects (Bug#34840)Vitalie Spinu2019-05-081-0/+41
| | | | | | | | | | | | * lisp/emacs-lisp/eieio-base.el (clone): Unbound slots of eieio-instance-inheritor objects as documented in the docs string and implemented in the original eieio implementation.
| * Fix cloning of eieio-named objects (Bug#22840)Vitalie Spinu2019-05-071-2/+13
| | | | | | | | | | * lisp/emacs-lisp/eieio-base.el (clone): Correctly set the name of the cloned objects from eieio-named instances.
* | Merge from origin/emacs-26Glenn Morris2019-04-291-0/+28
|\| | | | | | | | | | | | | 0e8d452 ; * doc/lispref/nonascii.texi (Coding System Basics): Fix gra... 25a2ff7 ; Add missing space in custom.texi 9ec18fb * admin/admin.el (set-version): Check for increase in version... 93912ba Be more careful about indent-sexp going over eol (Bug#35286)
| * Be more careful about indent-sexp going over eol (Bug#35286)Noam Postavsky2019-04-221-0/+28
| | | | | | | | | | | | | | | | * lisp/emacs-lisp/lisp-mode.el (indent-sexp): Only go over multiple sexps if the end of line is within a sexp. * test/lisp/emacs-lisp/lisp-mode-tests.el (indent-sexp-stop-before-eol-comment) (indent-sexp-stop-before-eol-non-lisp): New tests.
* | Make warning about unescaped character literals more helpful.Philipp Stephani2019-04-191-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See Bug#31676. * lisp/emacs-lisp/byte-run.el (byte-run--unescaped-character-literals-warning): New defun. * src/lread.c (load_warn_unescaped_character_literals): Use new defun. (syms_of_lread): Define symbol for new defun. * lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Use new defun. * test/src/lread-tests.el (lread-tests--unescaped-char-literals): test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--unescaped-char-literals): Adapt unit tests.
* | Use memql instead of memq in pcaseMattias Engdegård2019-03-281-1/+3
| | | | | | | | | | | | * lisp/emacs-lisp/pcase.el (pcase--u1): Use memql instead of memq to work with bignums (Bug#34781). * test/lisp/emacs-lisp/pcase-tests.el (pcase-tests-member): Test the above.
* | New seq-contains-p predicate (Bug#34852)Nicolas Petton2019-03-211-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/seq.el (seq-contains-p): New predicate function. It is a replacement for seq-contains which cannot be used as a predicate when a sequence contains nil values as it returns the element found. (seq-contains): Make obsolete. * test/lisp/emacs-lisp/seq-tests.el (test-seq-contains-p): (test-seq-intersection-with-nil, test-seq-set-equal-p-with-nil, test-difference-with-nil): Add regression tests. * doc/lispref/sequences.texi (Sequence Functions): Document seq-contains-p.
* | Disallow reversed char ranges in `rx'Mattias Engdegård2019-03-191-0/+4
| | | | | | | | | | | | | | | | | | | | (any "a-Z0-9") generated "[0-9]", and (any (?9 . ?0)) generated "[9-0]". Reversed ranges are either mistakes or abuse. Neither should be allowed. etc/NEWS: Explain the change. lisp/emacs-lisp/rx.el (rx): Document. (rx-check-any-string, rx-check-any): Add error checks for reversed ranges. test/lisp/emacs-lisp/rx-tests.el (rx-char-any-range-bad): New test.
* | Fix some ineffective backslashes in string literalsMattias Engdegård2019-03-162-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Deal with lone backslashes that have no effect in string literals, but indicate that something is amiss. * lisp/auth-source-pass.el (auth-source-pass-entries): * lisp/textmodes/artist.el (artist-figlet-get-font-list-windows): * lisp/org/ob-abc.el (org-babel-expand-body:abc, org-babel-execute:abc): * lisp/org/ob-forth.el (org-babel-forth-session-execute): * lisp/vc/vc-git.el (vc-git--program-version): Add backslash in regexp for correctness. * lisp/gnus/nnmail.el (nnmail-split-abbrev-alist): Replace `\||' with `\\|' to follow the obvious regexp intent. * lisp/org/org-list.el (org-plain-list-ordered-item-terminator): Add backslash in doc comment so that it appears as intended. * lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1, c-end-of-decl-1): * lisp/progmodes/f90.el (f90-font-lock-keywords-2): * lisp/progmodes/etags.el (etags-tags-completion-table): * lisp/progmodes/ruby-mode.el (ruby-syntax-propertize): * test/lisp/emacs-lisp/cl-print-tests.el (cl-print-tests-1): Remove superfluous backslashes from regexp. * test/lisp/emacs-lisp/rx-tests.el (rx-char-any): Remove superfluous backslash from doc comment.
* | rx: fix `or' ordering by adding argument to regexp-optMattias Engdegård2019-03-021-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The rx `or' form may reorder its arguments in an unpredictable way, contrary to user expectation, since it sometimes uses `regexp-opt'. Add a NOREORDER option to `regexp-opt' for preventing it from producing a reordered regexp (Bug#34641). * doc/lispref/searching.texi (Regular Expression Functions): * etc/NEWS (Lisp Changes in Emacs 27.1): Describe the new regexp-opt NOREORDER argument. * lisp/emacs-lisp/regexp-opt.el (regexp-opt): Add NOREORDER. Make no attempt at regexp improvement if the set of strings contains a prefix of another string. (regexp-opt--contains-prefix): New. * lisp/emacs-lisp/rx.el (rx-or): Call regexp-opt with NOREORDER. * test/lisp/emacs-lisp/rx-tests.el: Test rx `or' form match order.
* | Prevent over-eager rx character range condensationMattias Engdegård2019-02-161-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | `rx' incorrectly considers character ranges between ASCII and raw bytes to cover all codes in-between, which includes all non-ASCII Unicode chars. This causes (any "\000-\377" ?Å) to be simplified to (any "\000-\377"), which is not at all the same thing: [\000-\377] really means [\000-\177\200-\377] (Bug#34492). * lisp/emacs-lisp/rx.el (rx-any-condense-range): Split ranges going from ASCII to raw bytes. * test/lisp/emacs-lisp/rx-tests.el (rx-char-any-raw-byte): Add test case. * etc/NEWS: Mention the overall change (Bug#33205).
* | * test/lisp/emacs-lisp/package-tests.el: Allow extra extrasStefan Monnier2019-02-101-15/+51
| | | | | | | | | | | | | | (package-test--compatible-p): New function. (package-test-desc-from-buffer, package-test-install-single): Use it. (package-x-test-upload-buffer, package-x-test-upload-new-version): Don't burp in presence of extra extras.
* | Make the rx operators \? and \?? behave correctlyMattias Engdegård2019-02-011-0/+23
| | | | | | | | | | | | * lisp/emacs-lisp/rx.el (rx-kleene): Treat \? and \?? like ? and ?? (Bug#34100). * test/lisp/emacs-lisp/rx-tests.el: Add tests for all repetition operators.
* | Update more copyright yearsPaul Eggert2018-12-318-8/+8
| | | | | | | | | | | | | | | | Update some other copyright years automatically, by running: Run 'UPDATE_COPYRIGHT_YEAR=2019 \ UPDATE_COPYRIGHT_USE_INTERVALS=1 \ UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79 admin/update-copyright' followed by 'admin/merge-gnulib'.
* | Merge from origin/emacs-26Paul Eggert2018-12-3140-40/+40
|\| | | | | | | | | | | 2fcf2df Fix copyright years by hand 26bed8b Update copyright year to 2019 2814292 Fix value of default frame height. (Bug#33921)
| * Update copyright year to 2019Paul Eggert2019-01-0140-40/+40
| | | | | | | | Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
* | Handle raw bytes, and LF in ranges, in rx `any' argument stringsMattias Engdegård2018-12-291-0/+22
| | | | | | | | | | | | * lisp/emacs-lisp/rx.el (rx-check-any-string): Rewrite to handle raw bytes in unibyte strings and accept LF as range endpoints (Bug#33205). * test/lisp/emacs-lisp/rx-tests.el: Add tests for the above.
* | Merge from origin/emacs-26Glenn Morris2018-12-201-0/+5
|\| | | | | | | | | 081fb69 (origin/emacs-26) Check result from c-backward-token-2 to avo... f4ea746 cl-make-random-state was not copying its arg
| * cl-make-random-state was not copying its argPaul Eggert2018-12-191-0/+5
| | | | | | | | | | | | | | | | Problem reported by Xu Chunyang (Bug#33731). * lisp/emacs-lisp/cl-extra.el (cl-make-random-state): Use copy-sequence, not copy-tree, so that the record is copied. * test/lisp/emacs-lisp/cl-extra-tests.el: (cl-extra-test-cl-make-random-state): New test.