summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'savannah/master' into HEADAndrea Corallo2020-12-231-0/+41
|\
| * 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.
* | Fix native compiler tests when they are bytecompiledAndrea Corallo2020-12-211-174/+176
| | | | | | | | | | | | | | | | * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-test-ts) (comp-cstr-typespec-test, comp-cstr-typespec-tests-alist): Eval also at compile time. * test/src/comp-tests.el (comp-tests-type-spec-tests) (comp-tests-define-type-spec-test): Likewise.
* | Simplify correctly (or (integer 1 1) (not (integer 1 1))) as tAndrea Corallo2020-12-211-1/+3
| | | | | | | | | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-1-no-mem): Logic update. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add a test.
* | Symplify type specifier (not t) as nilAndrea Corallo2020-12-211-1/+5
| | | | | | | | | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-cstr-intersection-no-mem): Add logic. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add two tests.
* | * Add a type specifier test to comp-cstr-tests.elAndrea Corallo2020-12-211-1/+3
| | | | | | | | | | * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add a test.
* | * Fix a number of type specifier simplification testsAndrea Corallo2020-12-211-12/+28
| | | | | | | | | | * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Fix a number of tests.
* | Merge remote-tracking branch 'savannah/master' into HEADAndrea Corallo2020-12-201-0/+84
|\|
| * 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.
* | * Add initial negated non-negegated intersection supportAndrea Corallo2020-12-131-1/+23
| | | | | | | | | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-range-intersection): Cosmetic. (comp-cstr-intersection-homogeneous): Rename from `comp-cstr-intersection'. (comp-cstr-intersection): New function.
* | Normalize cstrs for cache hint effectiveness and test stabilityAndrea Corallo2020-12-121-6/+6
| | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-normalize-valset) (comp-union-valsets, comp-intersection-valsets) (comp-normalize-typeset): New functions. (comp-union-typesets, comp-intersect-typesets) (comp-cstr-union-homogeneous-no-range, comp-cstr-union-1-no-mem): Update to return normalized results. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Normalize expected type specifiers.
* | * Enumerate type specifier tests to ease debuggingAndrea Corallo2020-12-121-6/+60
| | | | | | | | | | | | | | * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Enumerate tests. Acked-by: Andrea Corallo <akrl@sdf.org>
* | Merge remote-tracking branch 'savannah/master' into HEADAndrea Corallo2020-12-125-6/+81
|\|
| * 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.
* | Merge remote-tracking branch 'savannah/master' into HEADAndrea Corallo2020-12-0630-0/+216
|\|
| * 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.
* | Couple of `comp-cstr-union-1-no-mem' improvements for mixed neg pos unionAndrea Corallo2020-12-061-2/+5
| | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-1-no-mem): Generalize disjoint pos types vs neg values conditions. (comp-cstr-union-1-no-mem): Do not propagate ranges when we are already returning integer as generic type. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add corresponding tests.
* | More improvements to `comp-cstr-union-1' for mixed positive/negative casesAndrea Corallo2020-12-051-2/+13
| | | | | | | | | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-1): Better handle mixed positive/negated cases. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add a number of tests.
* | Fix union of homogeneously negated input constraintsAndrea Corallo2020-12-051-1/+3
| | | | | | | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-1): Fix logic. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add a couple of tests.
* | Initial support for union of negated constraintsAndrea Corallo2020-12-051-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-range-negation): New function. (comp-cstr-union-homogeneous-no-range): Rename from `comp-cstr-union-no-range'. (comp-cstr-union-homogeneous): Rename from `comp-cstr-union'. (comp-cstr-union-1): New function. (comp-cstr-union-no-range, comp-cstr-union): Rewrite in function of `comp-cstr-union-1'. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add a bunch of tests.
* | Initial constraint negation supportAndrea Corallo2020-12-051-1/+2
| | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-cstr): Add `neg' slot. (comp-range-negation, comp-cstr-negation) (comp-cstr-negation-make): New functions. (comp-type-spec-to-cstr): Enable `not` in type specifiers. (comp-cstr-to-type-spec): Update logic to handle negation. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add a test.
* | Merge remote-tracking branch 'savannah/master' into HEADAndrea Corallo2020-11-291-0/+5
|\|
| * 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.
* | Add intersection support into comp-cstr.elAndrea Corallo2020-11-271-5/+18
| |
* | Move some tests from comp-tests.el to comp-cstr-tests.elAndrea Corallo2020-11-261-4/+16
| | | | | | | | | | | | | | | | * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add tests covering what was in: `range-simple-union', `union-types', `destructure-type-spec'. * test/src/comp-tests.el (range-simple-intersection, union-types) (destructure-type-spec): Remove tests.
* | Add comp-cstr.el and comp-cstr-tests.elAndrea Corallo2020-11-261-0/+68
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As the constraint logic of the compiler is not trivial and largely independent from the rest of the code move it into comp-cstr.el to ease separation and maintainability. This commit improve the conversion type specifier -> constraint for generality. Lastly this should help with bootstrap time as comp.el compilation unit is slimmed down. * lisp/emacs-lisp/comp-cstr.el: New file. (comp--typeof-types, comp--all-builtin-types): Move from comp.el. (comp-cstr, comp-cstr-f): Same + rename. (comp-cstr-ctxt): New struct. (comp-supertypes, comp-common-supertype-2) (comp-common-supertype, comp-subtype-p, comp-union-typesets) (comp-range-1+, comp-range-1-, comp-range-<, comp-range-union) (comp-range-intersection): Move from comp.el. (comp-cstr-union-no-range, comp-cstr-union): Move from comp.el and rename. (comp-cstr-union-make): New function. (comp-type-spec-to-cstr, comp-cstr-to-type-spec): Move from comp.el, rename it and rework it. * lisp/emacs-lisp/comp.el (comp-known-func-cstr-h): Rework. (comp-ctxt): Remove two fields and include `comp-cstr-ctxt'. (comp-mvar, comp-fwprop-call): Update for `comp-cstr' being renamed. (comp-fwprop-insn): Use `comp-cstr-union-no-range' or `comp-cstr-union'. (comp-ret-type-spec): Use `comp-cstr-union' and rework. * test/lisp/emacs-lisp/comp-cstr-tests.el: New file. (comp-cstr-test-ts, comp-cstr-typespec-test): New functions. (comp-cstr-typespec-tests-alist): New defconst to generate tests on. (comp-cstr-generate-tests): New macro. * test/src/comp-tests.el (comp-tests-type-spec-tests): Update. (ret-type-spec): Initialize constraint context.
* 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.