summaryrefslogtreecommitdiff
path: root/test/src/editfns-tests.el
Commit message (Collapse)AuthorAgeFilesLines
...
* Limit format fields to more POSIX-like specPaul Eggert2017-06-011-6/+22
| | | | | | | | | * doc/lispref/strings.texi (Formatting Strings): Don’t allow mixing numbered with unnumbered format specs. * src/editfns.c (styled_format): Don’t bother checking for field 0, since it doesn’t crash and the behavior is not specified. * test/src/editfns-tests.el (format-with-field): Adjust tests to match current doc. Add more tests for out-of-range fields.
* Minor improvements to format field numbersPaul Eggert2017-06-021-7/+3
| | | | | | | * src/editfns.c (styled_format): Allow field numbers in a %% spec. No need for a special diagnostic for field numbers greater than PTRDIFF_MAX. Reword diagnostic for field 0. * test/src/editfns-tests.el (format-with-field): Adjust to match.
* Implement field numbers in format stringsPhilipp Stephani2017-06-021-0/+18
| | | | | | | | | | | | | | | A field number explicitly specifies the argument to be formatted. This is especially important for potential localization work, since grammars of various languages dictate different word orders. * src/editfns.c (Fformat): Update documentation. (styled_format): Implement field numbers. * doc/lispref/strings.texi (Formatting Strings): Document field numbers. * lisp/emacs-lisp/bytecomp.el (byte-compile-format-warn): Adapt. * test/src/editfns-tests.el (format-with-field): New unit test.
* Port format-time-string to MS-Windows betterPaul Eggert2017-05-011-12/+15
| | | | | * test/src/editfns-tests.el (format-time-string-with-zone): Port test cases to MS-Windows.
* ; Fix typoKen Brown2017-05-011-1/+1
| | | | | * test/src/editfns-tests.el (format-time-string-with-zone): Fix typo in timezone specification.
* ; Fix commentary in a recent commitEli Zaretskii2017-05-011-7/+7
| | | | | * test/src/editfns-tests.el (format-time-string-with-zone): Minor copyedit in the commentary.
* Don’t stress-test time zones near the EpochPaul Eggert2017-05-011-11/+28
| | | | | | | * test/src/editfns-tests.el (format-time-string-with-zone) (format-time-string-with-outlandish-zone): Don’t format timestamps near the Epoch, as this runs into bugs on MS-Windows, and we don’t want to worry about those bugs.
* Test format-time-string with zone argPaul Eggert2017-04-271-0/+21
| | | | | * test/src/editfns-tests.el (format-time-string-with-zone) (format-time-string-with-outlandish-zone): New tests.
* Fix rounding error in ‘ceiling’ etc.Paul Eggert2017-03-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without this fix, (ceiling most-negative-fixnum -1.0) returns most-negative-fixnum instead of correctly signaling range-error, and similarly for floor, round, and truncate. * configure.ac (trunc): Add a check, since Gnulib’s doc says ‘trunc’ is missing from MSVC 9. The Gnulib doc says ‘trunc’ is also missing from some other older operating systems like Solaris 9 which I know we don’t care about any more, so MSVC is the only reason to worry about ‘trunc’ here. * src/editfns.c (styled_format): Formatting a float with %c is now an error. The old code did not work in general, because FIXNUM_OVERFLOW_P had rounding errors. Besides, the "if (FLOATP (...))" was in there only as a result of my misunderstanding old code that I introduced 2011. Although %d etc. is sometimes used on floats that represent huge UIDs or PIDs etc. that do not fit in fixnums, this cannot happen with characters. * src/floatfns.c (rounding_driver): Rework to do the right thing when the intermediate result equals 2.305843009213694e+18, i.e., is exactly 1 greater than MOST_POSITIVE_FIXNUM on a 64-bit host. Simplify so that only one section of code checks for overflow, rather than two. (double_identity): Remove. All uses changed to ... (emacs_trunc): ... this new function. Add replacement for platforms that lack ‘trunc’. * src/lisp.h (FIXNUM_OVERFLOW_P, make_fixnum_or_float): Make it clear that the arg cannot be floating point. * test/src/editfns-tests.el (format-c-float): New test. * test/src/floatfns-tests.el: New file, to test for this bug.
* Update copyright year to 2017 in masterPaul Eggert2017-01-011-1/+1
| | | | | | 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.
* Fix 'transpose-regions' when LEAVE-MARKERS arg is non-nilEli Zaretskii2016-07-191-0/+45
| | | | | | | | | | | | | | * src/insdel.c (adjust_markers_bytepos): New function. * src/lisp.h (adjust_markers_bytepos): Add prototype. * src/insdel.c (replace_range, replace_range_2): * src/editfns.c (Ftranspose_regions): Call adjust_markers_bytepos. (Bug#5131) * test/src/editfns-tests.el (transpose-test-reverse-word) (transpose-test-get-byte-positions): New functions. (transpose-ascii-regions-test) (transpose-nonascii-regions-test-1) (transpose-nonascii-regions-test-2): New tests.
* Minor tweaks of copying text properties when padding stringsEli Zaretskii2016-07-091-2/+26
| | | | | | | | * src/editfns.c (styled_format): Don't include padding on the left in the properties at the beginning of the string. (Bug#23897) * test/src/editfns-tests.el (format-properties): Add tests for faces when the string is padded on the left or on the right.
* Yet another fix for copying properties by 'format'Eli Zaretskii2016-07-081-1/+11
| | | | | | | | | | | | | * src/textprop.c (extend_property_ranges): Accept an additional argument OLD_END, and only extend the end of a property range if its original end is at OLD_END; all the other ranges are left intact. (Bug#23897) * src/editfns.c (styled_format): Pass the original length of the string to 'extend_property_ranges'. * src/intervals.h (extend_property_ranges): Adjust prototype. * test/src/editfns-tests.el (format-properties): Add tests for bug#23897.
* Add tests for copying properties by 'format'Eli Zaretskii2016-06-281-0/+57
* test/src/editfns-tests.el (format-properties): New test.