summaryrefslogtreecommitdiff
path: root/test/src/print-tests.el
Commit message (Collapse)AuthorAgeFilesLines
* ; Add 2024 to copyright yearsPo Lu2024-01-021-1/+1
|
* ; Add 2023 to copyright years.Eli Zaretskii2023-01-011-1/+1
|
* test: Remove redundant "" arg to `mapconcat`Stefan Monnier2022-09-081-2/+4
| | | | | | | | | | | | | | | | | | | * test/src/process-tests.el (process-test-stderr-filter): * test/src/print-tests.el (print-tests-continuous-numbering): * test/src/fns-tests.el (fns-tests-mapconcat): * test/src/data-tests.el (test-bool-vector-to-hex-string): * test/src/casefiddle-tests.el (casefiddle-tests-char-properties) (casefiddle-tests-case-table, casefiddle-tests-casing-character): * test/lisp/tabify-tests.el (tabify-tests--test-changes): * test/lisp/subr-tests.el (subr-tests-bug22027): * test/lisp/sort-tests.el (sort-tests-random-word): * test/lisp/net/hmac-md5-tests.el (hmac-md5-test-encode-string): * test/lisp/md4-tests.el (md4-tests-digest->hex): * test/lisp/emacs-lisp/cl-extra-tests.el (cl-extra-test-map): * test/lisp/dired-tests.el (dired-test-directory-files): * test/lisp/char-fold-tests.el (char-fold--random-word): * test/lisp/ansi-color-tests.el (ansi-color-incomplete-sequences-test): Remove redundant "" arg to `mapconcat`.
* ; Use values instead of trying to ignore themMattias Engdegård2022-07-311-9/+11
| | | | | | | | * test/lisp/subr-tests.el (test-print-unreadable-function): * test/src/print-tests.el (test-print-unreadable-function-buffer): Instead of binding the value of nominally side-effect-free expressions to an ignored variable (_), make use of them. This is more robust and provides useful extra checks in the test.
* ; Silence byte-compiler in two testsStefan Kangas2022-07-311-1/+2
| | | | | | * test/lisp/subr-tests.el (test-print-unreadable-function): * test/src/print-tests.el (test-print-unreadable-function-buffer): Pacify byte-compiler.
* Move a test from subr-tests to print-testsLars Ingebrigtsen2022-07-301-0/+10
|
* Ensure that we don't call print-unreadable-function from " prin1"Lars Ingebrigtsen2022-07-281-1/+0
| | | | | | | | * src/print.c (PRINTPREPARE): Bind the current buffer so that we can retrieve it later. (print_vectorlike): Use it (bug#56773). (syms_of_print): New internal `print--unreadable-callback-buffer' variable.
* Use `take` where clearly safe to do so (bug#56521)Mattias Engdegård2022-07-181-1/+1
| | | | | | | | | | | | | * lisp/emacs-lisp/seq.el (seq-take): * lisp/auth-source.el (auth-source-secrets-search) (auth-source-plstore-search): * lisp/gnus/message.el (message-insert-formatted-citation-line): * lisp/net/dbus.el (dbus-unregister-object): * lisp/replace.el (occur-context-lines): * test/src/print-tests.el (print-circular): Replace hand-written loop or `butlast` call with `take` for clarity, performance and validation. We have the equivalence (take N LIST) = (butlast LIST (- (length LIST) N)).
* Less wrong printed circular list tail index (bug#55395)Mattias Engdegård2022-05-231-0/+46
| | | | | | | | | | | | | | | | | When printing a circular list and `print-circle` is nil, use a somewhat more meaningful ". #N" tail index. The previous method for calculating that index was based on Floyd circularity detection being used so it had been broken ever since the change to Brent's algorithm. The new index is correct with respect to the start of the list itself which is what it used to be before being completely broken. It does not take into account the nesting depth of the list context. * src/print.c (struct print_stack_entry, print_object): Keep track of the tortoise index (which is cheap) instead of trying to derive it from the printed element index. * test/src/print-tests.el (print-test-rho, print-circular): New test.
* Make printing mostly non-recursive (bug#55481)Mattias Engdegård2022-05-181-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce explicit stacks for traversing common data types during printing: conses, vectors, records, byte-code, hash-tables and char-tables, all previously traversed using recursion in C. This greatly reduces the risk of crashing Emacs from C stack overflow when printing deeply nested data. * src/print.c (Fprinc, print, PRINT_CIRCLE_CANDIDATE_P): Special-case Fprinc with a plain string argument to eliminate the need for keeping track of print_depth during the preprocessing phase. This also improves performance. (struct print_pp_entry, struct print_pp_stack, ppstack) (grow_pp_stack, pp_stack_push_value, pp_stack_push_values) (pp_stack_empty_p, pp_stack_pop): New stack for preprocessing. (print_preprocess): Make mostly nonrecursive, except for string properties. (enum print_entry_type, struct print_stack_entry) (struct print_stack, prstack, grow_print_stack) (print_stack_push, print_stack_push_vector): New stack for printing. (print_vectorlike, print_object): Make mostly nonrecursive, except for string properties and some less heavily used types. * test/src/print-tests.el (print-deeply-nested): New test.
* Add OVERRIDES argument to prin1/prin1-to-stringLars Ingebrigtsen2022-05-151-0/+43
| | | | | | | | | | | | | | | | | * doc/lispref/streams.texi (Output Functions): Document it. (Output Overrides): New node. * src/process.c (Faccept_process_output): * src/print.c (debug_print, print_error_message): * src/pdumper.c (print_paths_to_root_1, decode_emacs_reloc): * src/lread.c (readevalloop): * src/eval.c (internal_lisp_condition_case): * src/editfns.c (styled_format): Adjust prin1/prin1-to-string callers. * src/print.c (Fprin1): Take an OVERRIDES parameter. (print_bind_overrides, print_bind_all_defaults): New functions. (Fprin1_to_string): Take an OVERRIDES parameter.
* Don't always escape "." and "?" in `prin1'Lars Ingebrigtsen2022-03-141-0/+8
| | | | | * src/print.c (print_object): Only escape "." and "?" when appearing as the first character in a symbol (bug#23130).
* Add new variable print-unreadable-functionLars Ingebrigtsen2022-01-221-0/+11
| | | | | | | | * doc/lispref/streams.texi (Output Variables): Document it. * src/print.c (print_vectorlike): Use the variable. (syms_of_print): New variable print-unreadable-function (bug#52566).
* ; Add 2022 to copyright years.Eli Zaretskii2022-01-011-1/+1
|
* Update copyright year to 2021Paul Eggert2021-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright".
* Reduce integer-output-format to print-integers-as-charactersMattias Engdegård2020-11-061-18/+21
| | | | | | | | | | | | | | | | | The variable now only controls whether characters are printed, not the radix. Control chars are printed in human-readable syntax only when special escapes such as ?\n are available. Spaces, formatting and combining chars are excluded (bug#44155). Done in collaboration with Juri Linkov. * src/character.c (graphic_base_p): * src/print.c (named_escape): New functions. (print_object): Change semantics as described above. (syms_of_print): Rename integer-output-format. Update doc string. * doc/lispref/streams.texi (Output Variables): * etc/NEWS: * test/src/print-tests.el (print-integers-as-characters): Rename and update according to new semantics. The test now passes.
* New variable integer-output-format to print integers as characters (bug#44155)Juri Linkov2020-10-311-0/+20
| | | | | | | | | | | * doc/lispref/streams.texi (Output Variables): Add integer-output-format. * src/print.c (print_object): In case of Lisp_Int, print integers as characters when Vinteger_output_format is Qt, and in hex format when Vinteger_output_format is 16. (Vinteger_output_format): New variable. * test/src/print-tests.el (print-integer-output-format): New test.
* Tweak a hash table print testLars Ingebrigtsen2020-09-201-1/+1
|
* Fix printing of hash tables with removed elementsPip Cet2020-09-201-0/+28
| | | | | | * src/print.c (print_vectorlike): Keep track of the actual number of elements printed rather than attempting to use hash bucket indices (bug#38892).
* ; Fix license statements.Stefan Kangas2020-08-271-3/+3
|
* Update copyright year to 2020Paul Eggert2020-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
* Fix print.c infloop on circular listsPaul Eggert2019-10-301-1/+5
| | | | | | | | | | | | | | Fix infinite loops in print.c when a circular list is passed to command-error-default-function or to error-message-string. * src/print.c (print_error_message): Use FOR_EACH_TAIL to avoid infloop on circular lists. (print_object): Use FOR_EACH_TAIL_SAFE, as it uses Brent’s teleporting tortoise-hare algorithm which is asymptotically better than the classic tortoise-hare algorithm that the code wsas using. * test/src/print-tests.el (print-circle-2): When print-circle is nil, do not insist on a particular cycle-detection heuristic. (error-message-string-circular): New test.
* Create common tests for print.c and cl-print.elGemini Lasswell2019-09-131-12/+247
| | | | | | | | | | | | | | | | | | | | | | | | * test/lisp/emacs-lisp/cl-print-tests.el (cl-print--test, cl-print-tests-1, cl-print-tests-2) (cl-print-tests-3, cl-print-tests-4, cl-print-tests-5) (cl-print-tests-strings, cl-print-circle, cl-print-circle-2): Remove. * test/src/print-tests.el (print-tests--prin1-to-string): New alias. (print-tests--deftest): New macro. (print-hex-backslash, print-read-roundtrip, print-bignum): Define with print-tests--deftest and use print-tests--prin1-to-string. (print-tests--prints-with-charset-p): Use print-tests--prin1-to-string. (print-tests--print-charset-text-property-nil) (print-tests--print-charset-text-property-t) (print-tests--print-charset-text-property-default): Define with print-tests--deftest. (print-tests-print-gensym) (print-tests-continuous-numbering, print-tests-1, print-tests-2) (print-tests-3, print-tests-4, print-tests-5) (print-tests-strings, print-circle, print-circle-2): New tests. (print--test, print-tests-struct): New cl-defstructs.
* Merge from origin/emacs-26Paul Eggert2018-12-311-1/+1
|\ | | | | | | | | | | 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-011-1/+1
| | | | | | | | Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
* | Fix mishandling of symbols that look like numbersPaul Eggert2018-10-101-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/bignum.c (make_neg_biguint): New function. * src/lread.c (read1): Do not mishandle an unquoted symbol with name equal to something like "1\0x", i.e., a string of numeric form followed by a NUL byte. Formerly these symbols were misread as numbers. (string_to_number): Change last argument from an integer flag to a pointer to the length. This lets the caller figure out how much of the prefix was used. All callers changed. Add a fast path if the integer (sans sign) fits in uintmax_t. Update comments and simplify now that bignums are present. * src/print.c (print_object): Fix quoting of symbols that look like numbers, by relying on string_to_number for the tricky cases rather than trying to redo its logic, incorrectly. For example, (read (prin1-to-string '\1e+NaN)) formerly returned "1e+NaN", which was wrong: a backslash is needed in the output to prevent it from being read as a NaN. Escape NO_BREAK_SPACE too, since lread.c treats it like SPACE. * test/src/print-tests.el (print-read-roundtrip): Add tests illustrating the abovementioned bugs.
* | Add some bignum testsTom Tromey2018-07-121-0/+6
| | | | | | | | | | | | | | | | * test/src/data-tests.el (data-tests-bignum, data-tests-+) (data-tests-/, data-tests-number-predicates): New tests. * test/src/fns-tests (test-bignum-eql): New test. * test/src/lread-tests (lread-long-hex-integer): Expect bignum. * test/src/print-tests (print-bignum): New test.
* | Honor print-charset-text-property value of nil (Bug#31376)Noam Postavsky2018-05-231-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/print.c (print_check_string_charset_prop): Move check for nil Vprint_charset_text_property from here... (print_prune_string_charset): ... to here. (syms_of_print) <print-charset-text-property>: Clarify that any non-boolean values are treated the same as `default'. * doc/lispref/streams.texi (Output Variables): Add print-prune-string-charset. * test/src/print-tests.el (print-charset-text-property-nil) (print-charset-text-property-default) (print-charset-text-property-t): New tests. (print-tests--prints-with-charset-p): New helper function.
* | Fix round tripping of read->print for symbols with strange quotesNoam Postavsky2018-01-281-0/+4
|/ | | | | | | | | | | | | | | | | Since 2017-07-22 "Signal error for symbol names with strange quotes (Bug#2967)", symbol names beginning with certain quote characters require an escaping backslash. However, the corresponding change for printing missed, so that (eq (read (prin1-to-string SYM)) SYM) does not give `t' for such symbols. * src/character.c (confusable_symbol_character_p): New function, extracted from test `read1'. * src/lread.c (read1): Use it. * src/print.c (print_object): Use it to print a backslash for symbols starting with characters that `read1' requires to be escaped. * test/src/print-tests.el (print-read-roundtrip): New test. * etc/NEWS.26: * etc/NEWS: Clarify the announcement for the earlier reader change (Bug#30217).
* Update copyright year to 2018Paul Eggert2018-01-011-1/+1
| | | | Run admin/update-copyright.
* Prefer HTTPS to FTP and HTTP in documentationPaul Eggert2017-09-131-1/+1
| | | | | | | | | | | | | Most of this change is to boilerplate commentary such as license URLs. This change was prompted by ftp://ftp.gnu.org's going-away party, planned for November. Change these FTP URLs to https://ftp.gnu.org instead. Make similar changes for URLs to other organizations moving away from FTP. Also, change HTTP to HTTPS for URLs to gnu.org and fsf.org when this works, as this will further help defend against man-in-the-middle attacks (for this part I omitted the MS-DOS and MS-Windows sources and the test tarballs to keep the workload down). HTTPS is not fully working to lists.gnu.org so I left those URLs alone for now.
* Merge from origin/emacs-25Paul Eggert2017-01-011-1/+1
| | | | | 2e2a806 Fix copyright years by hand 5badc81 Update copyright year to 2017
* Merge from origin/emacs-25John Wiegley2016-01-111-1/+1
| | | | | | ef33bc7 Spelling and grammar fixes 9c3dbab Fix copyright years by hand 0e96320 Update copyright year to 2016
* Rename all test files to reflect source layout.Phillip Lord2015-11-241-0/+62
* CONTRIBUTE,Makefile.in,configure.ac: Update to reflect test directory moves. * test/file-organisation.org: New file. * test/automated/Makefile.in test/automated/data/decompress/foo.gz test/automated/data/epg/pubkey.asc test/automated/data/epg/seckey.asc test/automated/data/files-bug18141.el.gz test/automated/data/flymake/test.c test/automated/data/flymake/test.pl test/automated/data/package/archive-contents test/automated/data/package/key.pub test/automated/data/package/key.sec test/automated/data/package/multi-file-0.2.3.tar test/automated/data/package/multi-file-readme.txt test/automated/data/package/newer-versions/archive-contents test/automated/data/package/newer-versions/new-pkg-1.0.el test/automated/data/package/newer-versions/simple-single-1.4.el test/automated/data/package/package-test-server.py test/automated/data/package/signed/archive-contents test/automated/data/package/signed/archive-contents.sig test/automated/data/package/signed/signed-bad-1.0.el test/automated/data/package/signed/signed-bad-1.0.el.sig test/automated/data/package/signed/signed-good-1.0.el test/automated/data/package/signed/signed-good-1.0.el.sig test/automated/data/package/simple-depend-1.0.el test/automated/data/package/simple-single-1.3.el test/automated/data/package/simple-single-readme.txt test/automated/data/package/simple-two-depend-1.1.el test/automated/abbrev-tests.el test/automated/auto-revert-tests.el test/automated/calc-tests.el test/automated/icalendar-tests.el test/automated/character-fold-tests.el test/automated/comint-testsuite.el test/automated/descr-text-test.el test/automated/electric-tests.el test/automated/cl-generic-tests.el test/automated/cl-lib-tests.el test/automated/eieio-test-methodinvoke.el test/automated/eieio-test-persist.el test/automated/eieio-tests.el test/automated/ert-tests.el test/automated/ert-x-tests.el test/automated/generator-tests.el test/automated/let-alist.el test/automated/map-tests.el test/automated/advice-tests.el test/automated/package-test.el test/automated/pcase-tests.el test/automated/regexp-tests.el test/automated/seq-tests.el test/automated/subr-x-tests.el test/automated/tabulated-list-test.el test/automated/thunk-tests.el test/automated/timer-tests.el test/automated/epg-tests.el test/automated/eshell.el test/automated/faces-tests.el test/automated/file-notify-tests.el test/automated/auth-source-tests.el test/automated/gnus-tests.el test/automated/message-mode-tests.el test/automated/help-fns.el test/automated/imenu-test.el test/automated/info-xref.el test/automated/mule-util.el test/automated/isearch-tests.el test/automated/json-tests.el test/automated/bytecomp-tests.el test/automated/coding-tests.el test/automated/core-elisp-tests.el test/automated/decoder-tests.el test/automated/files.el test/automated/font-parse-tests.el test/automated/lexbind-tests.el test/automated/occur-tests.el test/automated/process-tests.el test/automated/syntax-tests.el test/automated/textprop-tests.el test/automated/undo-tests.el test/automated/man-tests.el test/automated/completion-tests.el test/automated/dbus-tests.el test/automated/newsticker-tests.el test/automated/sasl-scram-rfc-tests.el test/automated/tramp-tests.el test/automated/obarray-tests.el test/automated/compile-tests.el test/automated/elisp-mode-tests.el test/automated/f90.el test/automated/flymake-tests.el test/automated/python-tests.el test/automated/ruby-mode-tests.el test/automated/subword-tests.el test/automated/replace-tests.el test/automated/simple-test.el test/automated/sort-tests.el test/automated/subr-tests.el test/automated/reftex-tests.el test/automated/sgml-mode-tests.el test/automated/tildify-tests.el test/automated/thingatpt.el test/automated/url-future-tests.el test/automated/url-util-tests.el test/automated/add-log-tests.el test/automated/vc-bzr.el test/automated/vc-tests.el test/automated/xml-parse-tests.el test/BidiCharacterTest.txt test/biditest.el test/cedet/cedet-utests.el test/cedet/ede-tests.el test/cedet/semantic-ia-utest.el test/cedet/semantic-tests.el test/cedet/semantic-utest-c.el test/cedet/semantic-utest.el test/cedet/srecode-tests.el test/cedet/tests/test.c test/cedet/tests/test.el test/cedet/tests/test.make test/cedet/tests/testdoublens.cpp test/cedet/tests/testdoublens.hpp test/cedet/tests/testfriends.cpp test/cedet/tests/testjavacomp.java test/cedet/tests/testnsp.cpp test/cedet/tests/testpolymorph.cpp test/cedet/tests/testspp.c test/cedet/tests/testsppcomplete.c test/cedet/tests/testsppreplace.c test/cedet/tests/testsppreplaced.c test/cedet/tests/testsubclass.cpp test/cedet/tests/testsubclass.hh test/cedet/tests/testtypedefs.cpp test/cedet/tests/testvarnames.c test/etags/CTAGS.good test/etags/ETAGS.good_1 test/etags/ETAGS.good_2 test/etags/ETAGS.good_3 test/etags/ETAGS.good_4 test/etags/ETAGS.good_5 test/etags/ETAGS.good_6 test/etags/a-src/empty.zz test/etags/a-src/empty.zz.gz test/etags/ada-src/2ataspri.adb test/etags/ada-src/2ataspri.ads test/etags/ada-src/etags-test-for.ada test/etags/ada-src/waroquiers.ada test/etags/c-src/a/b/b.c test/etags/c-src/abbrev.c test/etags/c-src/c.c test/etags/c-src/dostorture.c test/etags/c-src/emacs/src/gmalloc.c test/etags/c-src/emacs/src/keyboard.c test/etags/c-src/emacs/src/lisp.h test/etags/c-src/emacs/src/regex.h test/etags/c-src/etags.c test/etags/c-src/exit.c test/etags/c-src/exit.strange_suffix test/etags/c-src/fail.c test/etags/c-src/getopt.h test/etags/c-src/h.h test/etags/c-src/machsyscalls.c test/etags/c-src/machsyscalls.h test/etags/c-src/sysdep.h test/etags/c-src/tab.c test/etags/c-src/torture.c test/etags/cp-src/MDiagArray2.h test/etags/cp-src/Range.h test/etags/cp-src/burton.cpp test/etags/cp-src/c.C test/etags/cp-src/clheir.cpp.gz test/etags/cp-src/clheir.hpp test/etags/cp-src/conway.cpp test/etags/cp-src/conway.hpp test/etags/cp-src/fail.C test/etags/cp-src/functions.cpp test/etags/cp-src/screen.cpp test/etags/cp-src/screen.hpp test/etags/cp-src/x.cc test/etags/el-src/TAGTEST.EL test/etags/el-src/emacs/lisp/progmodes/etags.el test/etags/erl-src/gs_dialog.erl test/etags/f-src/entry.for test/etags/f-src/entry.strange.gz test/etags/f-src/entry.strange_suffix test/etags/forth-src/test-forth.fth test/etags/html-src/algrthms.html test/etags/html-src/index.shtml test/etags/html-src/software.html test/etags/html-src/softwarelibero.html test/etags/lua-src/allegro.lua test/etags/objc-src/PackInsp.h test/etags/objc-src/PackInsp.m test/etags/objc-src/Subprocess.h test/etags/objc-src/Subprocess.m test/etags/objcpp-src/SimpleCalc.H test/etags/objcpp-src/SimpleCalc.M test/etags/pas-src/common.pas test/etags/perl-src/htlmify-cystic test/etags/perl-src/kai-test.pl test/etags/perl-src/yagrip.pl test/etags/php-src/lce_functions.php test/etags/php-src/ptest.php test/etags/php-src/sendmail.php test/etags/prol-src/natded.prolog test/etags/prol-src/ordsets.prolog test/etags/ps-src/rfc1245.ps test/etags/pyt-src/server.py test/etags/tex-src/gzip.texi test/etags/tex-src/nonewline.tex test/etags/tex-src/testenv.tex test/etags/tex-src/texinfo.tex test/etags/y-src/atest.y test/etags/y-src/cccp.c test/etags/y-src/cccp.y test/etags/y-src/parse.c test/etags/y-src/parse.y test/indent/css-mode.css test/indent/js-indent-init-dynamic.js test/indent/js-indent-init-t.js test/indent/js-jsx.js test/indent/js.js test/indent/latex-mode.tex test/indent/modula2.mod test/indent/nxml.xml test/indent/octave.m test/indent/pascal.pas test/indent/perl.perl test/indent/prolog.prolog test/indent/ps-mode.ps test/indent/ruby.rb test/indent/scheme.scm test/indent/scss-mode.scss test/indent/sgml-mode-attribute.html test/indent/shell.rc test/indent/shell.sh test/redisplay-testsuite.el test/rmailmm.el test/automated/buffer-tests.el test/automated/cmds-tests.el test/automated/data-tests.el test/automated/finalizer-tests.el test/automated/fns-tests.el test/automated/inotify-test.el test/automated/keymap-tests.el test/automated/print-tests.el test/automated/libxml-tests.el test/automated/zlib-tests.el: Files Moved.