1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-20 10:23:57 +00:00
Commit Graph

77 Commits

Author SHA1 Message Date
Glenn Morris
2389ba2ebe Suppress intermittent test failure on hydra
* test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
(eieio-test-37-obsolete-name-in-constructor): Skip on hydra.
2017-05-23 20:44:52 -04:00
Noam Postavsky
750f0e2e79 Make sure indent-sexp stops at end of sexp (Bug#26878)
* lisp/emacs-lisp/lisp-mode.el (indent-sexp): Check endpos before
indenting.
* test/lisp/emacs-lisp/lisp-mode-tests.el (indent-sexp-stop): New
test.
2017-05-15 22:58:17 -04:00
Marcin Borkowski
9a5e864de7 Merge branch 'fix/bug-21072' 2017-05-14 07:09:54 +02:00
Philipp
a1d4615921 Make `old-style-backquotes' variable internal
* src/lread.c (load_warn_old_style_backquotes, Fload, read1)
(syms_of_lread): Rename `old-style-backquotes' to
`lread--old-style-backquotes', and clarify that it's for internal
use only.
* lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Rename
variable.
* test/src/lread-tests.el (lread-tests--old-style-backquotes): Add
unit test.
* emacs-lisp/bytecomp-tests.el
(bytecomp-tests--old-style-backquotes): Add unit test.
2017-05-13 12:32:29 +02:00
Philipp Stephani
16004397f4 Improve unescaped character literal warnings
* src/lread.c (load_warn_unescaped_character_literals)
(syms_of_lread):
lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Improve
formatting of unescaped character literal warnings.

* 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.
2017-05-13 12:28:48 +02:00
Noam Postavsky
cb8fcbc3cb Fix elisp-tests-with-temp-buffer compilation
* test/lisp/emacs-lisp/lisp-tests.el (elisp-tests-with-temp-buffer):
Don't refer to the =!NAME= as "markers" since they produce variables
with just plain positions, not marker objects.  Explicitly specify
that CONTENTS is evaluated at compile time.  Don't re-evaluate
CONTENTS at runtime.  Fix debug specification.  Suppress warnings due
to BODY not using =!NAME= variables.
(elisp-test-point-position-regex): Rename from
`elisp-test-point-marker-regex'.
(mark-defun-test-buffer): Wrap in `eval-and-compile'.
2017-05-12 11:40:48 +02:00
Marcin Borkowski
22fc91704b Fix Bug#21072 and rework `mark-defun'
* test/lisp/progmodes/elisp-mode-tests.el (mark-defun-test-buffer):
  New variable
(mark-defun-no-arg-region-inactive)
(mark-defun-no-arg-region-active)
(mark-defun-arg-region-active)
(mark-defun-pos-arg-region-inactive)
(mark-defun-neg-arg-region-inactive, mark-defun-bob): Add tests for
the new `mark-defun'.

* lisp/emacs-lisp/lisp.el (beginning-of-defun--in-emptyish-line-p):
  New function.
(beginning-of-defun-comments): New function.
(mark-defun): Fix bug#21072, also rewrite large parts of `mark-defun'
to accept a numerical prefix argument.
2017-05-12 11:36:27 +02:00
Noam Postavsky
e7b6751c0a Fix lisp-indent-region and indent-sexp (Bug#26619)
The new lisp-indent-region introduced in 2017-04-22 "Add new
`lisp-indent-region' that doesn't reparse the code." is broken because
it doesn't save the calculated indent amounts for already seen sexp
depths.  Fix this by unifying the indent-sexp and lisp-indent-region
code.  Furthermore, only preserve position 2 of the running parse
when the depth doesn't change.
* lisp/emacs-lisp/lisp-mode.el (lisp-ppss): Use an OLDSTATE that
corresponds with the start point when calling parse-partial-sexp.
(lisp-indent-state): New struct.
(lisp-indent-calc-next): New function, extracted from indent-sexp.
(indent-sexp, lisp-indent-region): Use it.
(lisp-indent-line): Take indentation, instead of parse state.
* test/lisp/emacs-lisp/lisp-mode-tests.el
(lisp-mode-tests--correctly-indented-sexp): New constant.
(lisp-indent-region, lisp-indent-region-defun-with-docstring):
(lisp-indent-region-open-paren, lisp-indent-region-in-sexp): New
tests.
2017-05-09 20:50:19 -04:00
Marcin Borkowski
6d58dda40a Add elisp-tests-with-temp-buffer, a new testing macro
* test/lisp/emacs-lisp/lisp-tests.el
(elisp-test-point-marker-regex) New variable.
(elisp-tests-with-temp-buffer): New macro to help test functions
moving the point and/or mark.
2017-05-09 14:26:08 +02:00
Damien Cassou
88f96e69cf Add seq-set-equal-p to test for set equality
* lisp/emacs-lisp/seq.el (seq-set-equal-p): Add function to compare
  two lists as if they were sets.

* test/lisp/emacs-lisp/seq-tests.el (test-seq-set-equal-p): Add test
  for seq-set-equal-p.
2017-05-04 11:32:58 +02:00
Philipp Stephani
c2bbdc3316 Warn about missing backslashes during load
* src/lread.c (load_warn_unescaped_character_literals, Fload, read1)
(syms_of_lread): Warn if unescaped character literals are
found (Bug#20152).
* lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Check for
unescaped character literals during byte compilation.
* test/src/lread-tests.el (lread-tests--unescaped-char-literals): New
unit test.
(lread-tests--with-temp-file, lread-tests--last-message): Helper
functions for unit test.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-tests--unescaped-char-literals): New unit test.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--with-temp-file):
Helper macro for unit test.
2017-05-01 20:39:10 +02:00
Glenn Morris
fe2ba41f18 Suppress intermittent test failure on hydra
* test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el
(eieio-test-method-order-list-6): Skip on hydra.
2017-04-25 16:20:38 -04:00
Noam Postavsky
43c84577a3 Don't reparse the sexp in indent-sexp (Bug#25122)
* lisp/emacs-lisp/lisp-mode.el (calculate-lisp-indent): Let
PARSE-START be a parse state that can be reused.
(indent-sexp): Pass the running parse state to calculate-lisp-indent
instead of the sexp beginning position.  Saving the
CONTAINING-SEXP-START returned by `calculate-lisp-indent' is no longer
needed.  Don't bother stopping if we don't descend below init-depth,
since we now alway scan the whole buffer (via syntax-ppss) anyway.
* test/lisp/emacs-lisp/lisp-mode-tests.el (indent-sexp): Add blank
line to test case.
2017-04-22 14:09:57 -04:00
Vibhav Pant
66dc8dd6d1 Add cond test cases for singleton clauses.
* test/lisp/emacs-lisp/bytecomp-tests.el: Add test cond forms where
  the default clause is a single non-nil expression.
2017-04-22 22:08:16 +05:30
Stefan Monnier
89898e43c7 * lisp/emacs-lisp/cl-macs.el: Fix symbol-macrolet
Revert 0d112c00ba (to fix bug#26325)
and use a different fix for bug#26068.
(cl--symbol-macro-key): New function.
(cl--sm-macroexpand, cl-symbol-macrolet): Use it instead of `symbol-name`.
* test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-symbol-macrolet):
Failure is not expected any more.
2017-04-21 12:12:42 -04:00
Glenn Morris
449bc49c76 Update a package test for hydra
* test/lisp/emacs-lisp/package-tests.el (with-package-test):
Also bind package-gnupghome-dir, see eg
http://hydra.nixos.org/build/51462182 .
2017-04-11 08:42:54 -07:00
Stefan Monnier
2c68192c6b Backward compatibility with pre-existing struct instances.
* lisp/emacs-lisp/cl-lib.el (cl--old-struct-type-of): New function.
(cl-old-struct-compat-mode): New minor mode.

* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Pass `record' to
cl-struct-define to signal use of record objects.

* lisp/emacs-lisp/cl-preloaded.el (cl--struct-get-class,
cl-struct-define): Enable legacy defstruct compatibility.

* test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-old-struct,
old-struct): New tests.

* doc/lispref/elisp.texi, doc/lispref/records.texi: Document
`old-struct-compat'.
2017-04-04 08:23:46 +02:00
Lars Brinkhoff
0565482838 Make cl-defstruct use records.
* lisp/emacs-lisp/cl-extra.el (cl--describe-class)
(cl--describe-class-slots): Use the new `type-of'.

* lisp/emacs-lisp/cl-generic.el (cl--generic-struct-tag): Use type-of.
(cl--generic-struct-specializers): Adjust to new tag.

* lisp/emacs-lisp/cl-macs.el (cl-defstruct): When type is nil, use records.
Use the type symbol as the tag.  Use copy-record to copy structs.
(cl--defstruct-predicate): New function.
(cl--pcase-mutually-exclusive-p): Use it.
(cl-struct-sequence-type): Can now return `record'.

* lisp/emacs-lisp/cl-preloaded.el (cl--make-slot-desc): Adjust ad-hoc
code to new format.
(cl--struct-register-child): Work with records.
(cl-struct-define): Don't touch the tag's symbol-value and
symbol-function slots when we use the type as tag.

* lisp/emacs-lisp/cl-print.el (cl-print-object): Adjust to new tag.

* test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-defstruct-record):
New test.

* doc/lispref/records.texi, doc/misc/cl.texi: Update for records.
2017-04-04 08:23:46 +02:00
Lars Brinkhoff
a2c3343029 Add record objects with user-defined types.
* src/alloc.c (allocate_record): New function.
(Fmake_record, Frecord, Fcopy_record): New functions.
(syms_of_alloc): defsubr them.
(purecopy): Work with records.

* src/data.c (Ftype_of): Return slot 0 for record objects, or type
name if record's type holds class.
(Frecordp): New function.
(syms_of_data): defsubr it.  Define `Qrecordp'.
(Faref, Faset): Work with records.

* src/fns.c (Flength): Work with records.

* src/lisp.h (prec_type): Add PVEC_RECORD.
(RECORDP, CHECK_RECORD, CHECK_RECORD_TYPE): New functions.

* src/lread.c (read1): Add syntax for records.

* src/print.c (PRINT_CIRCLE_CANDIDATE_P): Add RECORDP.
(print_object): Add syntax for records.

* test/lisp/emacs-lisp/cl-print-tests.el (cl-print-tests-2):
New test.

* test/src/alloc-tests.el (record-1, record-2, record-3):
New tests.

* doc/lispref/elisp.texi, doc/lispref/objects.texi,
doc/lispref/records.texi: Add documentation for records.
2017-04-04 08:23:46 +02:00
Stefan Monnier
acce29d6c5 * test/lisp/emacs-lisp/cl-lib-tests.el: Improve symbol-macrolet tests
(cl-lib-symbol-macrolet): Fix last test so it doesn't break the whole
test suite.
(cl-lib-symbol-macrolet-2): New test.
2017-04-01 12:11:07 -04:00
Stefan Monnier
1f5b4ed628 * test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-symbol-macrolet): New test. 2017-03-31 10:05:12 -04:00
Noam Postavsky
0b60d7657a * test/lisp/emacs-lisp/lisp-mode-tests.el (indent-subsexp): Test for Bug#26187 2017-03-21 20:45:32 -04:00
Tino Calancha
7a50abee22 * test/lisp/emacs-lisp/cl-print-tests.el (cl-print-tests-1): Fix regexp. 2017-03-13 20:01:40 +09:00
Noam Postavsky
3ee3995d10 * lisp/emacs-lisp/lisp-mode.el (indent-sexp): Simplify.
* test/lisp/emacs-lisp/lisp-mode-tests.el (indent-sexp):
(indent-subsexp, indent-sexp-in-string): New tests.
2017-03-12 20:08:32 -04:00
Glenn Morris
de610c4b67 Update a cl-print test
* test/lisp/emacs-lisp/cl-print-tests.el (cl-print-tests-1):
Update for recent change in cl-print-object function output.
2017-03-08 14:43:16 -05:00
Tino Calancha
244de7b0ed Use lexical binding in benchmark.el
* lisp/emacs-lisp/benchmark.el: Enable lexical binding.
(benchmark-elapse): Use 'declare'.
* test/lisp/emacs-lisp/benchmark-tests.el: Add test suite.
2017-03-03 18:26:30 +09:00
Noam Postavsky
f5388ba8a7 Switch pp.el to lexical binding
Additionally, do some minor code cleanup.

* lisp/emacs-lisp/pp.el: Set lexical-binding.
(pp-buffer): Use skip-syntax-forward.
(pp-eval-expression): Use push.
(pp-last-sexp): Use with-syntax-table.
* test/lisp/emacs-lisp/pp-tests.el: New tests.
2017-03-02 23:03:20 -05:00
Tino Calancha
4daca38d5c Prevent for consing in cl-mapc and cl-mapl
* lisp/emacs-lisp/cl-extra.el (cl--mapcar-many): Add optional arg ACC;
If non-nil, accumulate values in the result (Bug#25826).
(cl-mapc): Do computations inside function instead of call cl-map.
(cl-mapl): Do computations inside function instead of call cl-maplist.
* lisp/emacs-lisp/cl-lib.el (mapcar): Add autoload cookie.
Call cl--mapcar-many with non-nil 3rd argument.
* test/lisp/emacs-lisp/cl-extra-tests.el (cl-extra-test-map)
(cl-extra-test-mapc, cl-extra-test-mapcar, cl-extra-test-mapl)
(cl-extra-test-maplist): New tests.
2017-02-27 16:32:10 +09:00
Noam Postavsky
546d30ed14 Don't use IP 0.0.0.0 for package test server (Bug#22582)
* test/lisp/emacs-lisp/package-resources/package-test-server.py: Set
'server_address' when port number is given on the command line.  Print
IP and port number as a URL, and flush it after printing.
* test/lisp/emacs-lisp/package-tests.el:
(package-test-update-archives-async): Grab the whole URL from server
output.
2017-02-25 12:56:09 -05:00
Stefan Monnier
407e650413 * lisp/emacs-lisp/cl-print.el: New file
* lisp/emacs-lisp/nadvice.el (advice--where): New function.
(advice--make-docstring): Use it.

* src/print.c (print_number_index): Don't declare here any more.
(Fprint_preprocess): New function.

* test/lisp/emacs-lisp/cl-print-tests.el: New file.
2017-02-23 21:06:54 -05:00
Noam Postavsky
2f53c0c468 Simplify cl-get using `plist-member'
* lisp/emacs-lisp/cl-extra.el (cl-get, cl-getf, cl--set-getf): Use
`plist-member' instead of explicit loop.
* test/lisp/emacs-lisp/cl-extra-tests.el: New tests.
2017-02-20 16:53:14 -05:00
Vibhav Pant
96e18ebb99 bytecomp-tests.el: Store all test forms in one constant.
* test/lisp/emacs-lisp/bytecomp-tests.el: Store all test expressions
in a single constant (byte-opt-testsuite-arith-data), add new forms
which generate lapcode with adjacent/redundant tags.
2017-02-15 21:12:44 +05:30
Vibhav Pant
c24e8290fa test/lisp/emacs-lisp/bytecomp-tests.el: Add more tests for switch. 2017-02-13 13:18:54 +05:30
Vibhav Pant
96c4e367f9 Add tests for checking byte-switch code.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-cond): New test,
  test byte-switch bytecode.
2017-02-07 19:35:20 +05:30
Gemini Lasswell
331eb6c915 Add tests for lisp/emacs-lisp/testcover.el
* test/lisp/emacs-lisp/testcover-tests.el: New file.
* test/lisp/emacs-lisp/testcover-resources/testcases.el: New file.

Co-authored-by: Noam Postavsky <npostavs@users.sourceforge.net>
2017-02-04 11:43:50 +02:00
Juanma Barranquero
375c70fd9e test/*.el: Avoid byte-compiler warnings
* test/lisp/abbrev-tests.el (abbrev-table-p-test): Remove unused 'let*'.

* test/lisp/faces-tests.el (faces--test): New customization group.
(faces--test1, faces--test2): Use it.

* test/lisp/ffap-tests.el (ffap-tests-25243):
Call 'mark-whole-buffer' interactively.

* test/lisp/ibuffer-tests.el (ibuffer-filter-groups, ibuffer-filtering-alist)
(ibuffer-filtering-qualifiers, ibuffer-save-with-custom)
(ibuffer-saved-filter-groups, ibuffer-saved-filters): Defvar.
(ibuffer-format-qualifier, ibuffer-unary-operand): Declare.

* test/lisp/minibuffer-tests.el (completion-test1):
Mark unused lexical arguments.

* test/lisp/simple-tests.el (simple-test--dummy-buffer): Wrap result in
'with-no-warnings' to avoid them when the macro is invoked for effect.

* test/lisp/emacs-lisp/cl-seq-tests.el (cl-seq-count-test):
Mark unused lexical arguments.

* test/lisp/emacs-lisp/let-alist-tests.el (let-alist-surface-test):
Mark unused lexical arguments.
(let-alist-cons): Remove unused let binding.

* test/lisp/net/dbus-tests.el (dbus-debug): Defvar.
(dbus-get-unique-name): Declare.

* test/lisp/progmodes/python-tests.el (python-bob-infloop-avoid):
Call 'font-lock-fontify-buffer' interactively.

* test/lisp/textmodes/tildify-tests.el (tildify-space-undo-test--test):
Mark unused lexical argument.
2017-01-28 04:40:36 +01:00
Paul Eggert
e6a782ee1a Update copyright year to 2017 in master
Run admin/update-copyright in the master branch.  This fixes files
that were not already fixed in the emacs-25 branch before it was
merged here.
2017-01-01 01:48:59 -08:00
Paul Eggert
bcf244ef9b Merge from origin/emacs-25
2e2a806 Fix copyright years by hand
5badc81 Update copyright year to 2017
2017-01-01 01:10:47 -08:00
Philipp Stephani
4bbd5424a2 Checkdoc: use syntax functions instead of regex
In checkdoc.el, get rid of the error-prone regex to find definition
forms, and use existing syntax-based navigation functions instead.
This fixes a corner case with one-argument `defvar' forms.

* lisp/emacs-lisp/checkdoc.el (checkdoc--next-docstring): New function.
(checkdoc-next-docstring, checkdoc-defun): Use it.
* test/lisp/emacs-lisp/checkdoc-tests.el (checkdoc-tests--next-docstring):
Add unit test.
2016-12-31 17:30:46 +01:00
Philipp Stephani
65b997b95e Checkdoc: Don't require a space before an arg list
See Bug#24998.

* lisp/emacs-lisp/checkdoc.el (checkdoc-defun-regexp): Don't require a
space before a argument list.
* test/lisp/emacs-lisp/checkdoc-tests.el (checkdoc-tests--bug-24998):
Add unit test.
2016-12-26 21:13:26 +01:00
Noam Postavsky
a7523ba955 Fix rx-any with range with ?\] and ?-
* lisp/emacs-lisp/rx.el: Make sure not to produce a circular
list (Bug#25123).
* test/lisp/emacs-lisp/rx-tests.el (rx-char-any): New test.
2016-12-18 08:44:45 -05:00
Nicolas Petton
fb2fdb1435 Make seq-into return the sequence when no conversion needed
* lisp/emacs-lisp/seq.el (seq-into): Do not convert the sequence when
  no conversion is needed.
* test/lisp/emacs-lisp/seq-tests.el (test-seq-into-and-identity): Add
  a regression test checking for identity.
2016-12-16 11:22:00 +01:00
Nicolas Petton
09a66ceb5e Fix circular list handling in seq-mapn
* lisp/emacs-lisp/seq.el (seq-mapn): Do not copy list arguments.
* test/lisp/emacs-lisp/seq-tests.el (test-seq-mapn-circular-lists):
  Add a regression test.
2016-12-15 10:26:11 +01:00
Noam Postavsky
58e418d2ce Fix ert-tests when running compiled
* test/lisp/emacs-lisp/ert-tests.el (ert-test-deftest): Don't test for
specific macroexpansion, just check result of evaluation.
(ert-test-record-backtrace): Don't hardcode representation of closure in
expected backtrace, this lets the test succeed even when the test code
is compiled.

* lisp/emacs-lisp/ert.el (ert--expand-should-1): Also pass
`byte-compile-macro-environment' to `macroexpand', this allows the
`should' macro to properly handle macroexpansion of macros that were
defined in the same file when it's being compiled (Bug #17851).
2016-12-06 22:20:23 -05:00
Nicolas Petton
f63976857b
Do not use map.el in seq-tests.el
* test/lisp/emacs-lisp/seq-tests.el: Do not use map.el.  map.el was
introduced in Emacs 25.1, but seq.el is also available in GNU ELPA for
Emacs 24.5.
2016-11-16 18:37:26 +01:00
Damien Cassou
bd22beb6e4 Add seq-random-elt to seq.el
* lisp/emacs-lisp/seq.el (seq-random-elt): Add function to return a
  random element from it's sequence parameter.

* test/lisp/emacs-lisp/seq-tests.el (test-seq-random-elt-take-all
  test-seq-random-elt-return-nil): Test the new function

* doc/lispref/sequences.texi: Document the new function
2016-10-25 12:32:57 +02:00
Tino Calancha
f63a4b82f0 cl-seq: Remove max limit on input sequence length
* lisp/emacs-lisp/cl-seq.el (cl-fill, cl-replace, cl-delete)
(cl--position, cl-nsubstitute, cl-substitute, cl-remove):
Remove limit on maximum length for the input sequence
(#Bug24264).
* test/lisp/emacs-lisp/cl-seq-tests.el: Update test expected result as passed.
2016-10-20 19:51:55 +09:00
Philipp Stephani
5b774598f4 Don’t consider nested let-alist forms
See Bug#24641.

* lisp/emacs-lisp/let-alist.el (let-alist--deep-dot-search): Don’t
consider symbols in nested ‘let-alist’ forms.

* test/lisp/emacs-lisp/let-alist-tests.el
(let-alist--deep-dot-search--nested): Add a unit test.
2016-10-08 18:36:54 +02:00
Eli Zaretskii
7f287b7f78 Incorporate syntax-tests in lisp-tests.
* test/lisp/emacs-lisp/lisp-tests.el: Add tests from
test/lisp/legacy/syntax-tests.el.
* test/lisp/legacy/syntax-tests.el: File deleted.
2016-09-24 13:20:19 +03:00
Eli Zaretskii
4e71b5b343 Incorporate lexbind-tests.el in bytecomp-test.el
* test/lisp/emacs-lisp/bytecomp-tests.el: Added tests from
test/lisp/legacy/lexbind-tests.el.
* test/lisp/legacy/lexbind-tests.el: File deleted.
2016-09-24 12:53:46 +03:00