diff options
| author | Stefan Kangas | 2021-10-21 19:53:00 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2021-10-31 03:02:32 +0100 |
| commit | 54b8ec4e6fb1eeac049e7bd68372e78c180fe8e4 (patch) | |
| tree | ebcb91138aae1c7f7234f0540b9f275c22f19655 | |
| parent | 8227d1273e2b82dbed14c0cba06959083d377745 (diff) | |
| download | emacs-54b8ec4e6fb1eeac049e7bd68372e78c180fe8e4.tar.gz emacs-54b8ec4e6fb1eeac049e7bd68372e78c180fe8e4.zip | |
Remove workaround for fixed Bug#6581 from ert
* lisp/emacs-lisp/ert.el (ert-equal-including-properties): Make
into obsolete function alias for 'equal-including-properties'.
* test/src/editfns-tests.el (format-properties):
* test/lisp/emacs-lisp/ert-x-tests.el (ert-propertized-string)
(ert-test-run-tests-interactively-2): Don't use above obsolete
name.
(ert--explain-equal-including-properties-rec): New function.
(ert--explain-equal-including-properties): Use as an explainer for
'equal-including-properties' now that Bug#6581 is fixed.
* test/lisp/emacs-lisp/ert-tests.el
(ert-test-explain-equal-string-properties): Expand test.
(ert-test-equal-including-properties): Merge test into above
expanded test.
| -rw-r--r-- | lisp/emacs-lisp/ert.el | 55 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/ert-tests.el | 55 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/ert-x-tests.el | 8 | ||||
| -rw-r--r-- | test/src/editfns-tests.el | 48 |
4 files changed, 78 insertions, 88 deletions
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index f7cf1e4289a..aff38040271 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el | |||
| @@ -89,24 +89,6 @@ Use nil for no limit (caution: backtrace lines can be very long)." | |||
| 89 | :background "red3")) | 89 | :background "red3")) |
| 90 | "Face used for unexpected results in the ERT results buffer.") | 90 | "Face used for unexpected results in the ERT results buffer.") |
| 91 | 91 | ||
| 92 | |||
| 93 | ;;; Copies/reimplementations of cl functions. | ||
| 94 | |||
| 95 | ;; FIXME: Bug#6581 is fixed, so this should be deleted. | ||
| 96 | (defun ert-equal-including-properties (a b) | ||
| 97 | "Return t if A and B have similar structure and contents. | ||
| 98 | |||
| 99 | This is like `equal-including-properties' except that it compares | ||
| 100 | the property values of text properties structurally (by | ||
| 101 | recursing) rather than with `eq'. Perhaps this is what | ||
| 102 | `equal-including-properties' should do in the first place; see | ||
| 103 | Emacs bug 6581 at URL `https://debbugs.gnu.org/cgi/bugreport.cgi?bug=6581'." | ||
| 104 | ;; This implementation is inefficient. Rather than making it | ||
| 105 | ;; efficient, let's hope bug 6581 gets fixed so that we can delete | ||
| 106 | ;; it altogether. | ||
| 107 | (not (ert--explain-equal-including-properties a b))) | ||
| 108 | |||
| 109 | |||
| 110 | ;;; Defining and locating tests. | 92 | ;;; Defining and locating tests. |
| 111 | 93 | ||
| 112 | ;; The data structure that represents a test case. | 94 | ;; The data structure that represents a test case. |
| @@ -467,7 +449,7 @@ Errors during evaluation are caught and handled like nil." | |||
| 467 | 449 | ||
| 468 | (defun ert--explain-equal-rec (a b) | 450 | (defun ert--explain-equal-rec (a b) |
| 469 | "Return a programmer-readable explanation of why A and B are not `equal'. | 451 | "Return a programmer-readable explanation of why A and B are not `equal'. |
| 470 | Returns nil if they are." | 452 | Return nil if they are." |
| 471 | (if (not (eq (type-of a) (type-of b))) | 453 | (if (not (eq (type-of a) (type-of b))) |
| 472 | `(different-types ,a ,b) | 454 | `(different-types ,a ,b) |
| 473 | (pcase a | 455 | (pcase a |
| @@ -600,14 +582,9 @@ If SUFFIXP is non-nil, returns a suffix of S, otherwise a prefix." | |||
| 600 | (t | 582 | (t |
| 601 | (substring s 0 len))))) | 583 | (substring s 0 len))))) |
| 602 | 584 | ||
| 603 | ;; TODO(ohler): Once bug 6581 is fixed, rename this to | 585 | (defun ert--explain-equal-including-properties-rec (a b) |
| 604 | ;; `ert--explain-equal-including-properties-rec' and add a fast-path | 586 | "Return explanation of why A and B are not `equal-including-properties'. |
| 605 | ;; wrapper like `ert--explain-equal'. | 587 | Return nil if they are." |
| 606 | (defun ert--explain-equal-including-properties (a b) | ||
| 607 | "Explainer function for `ert-equal-including-properties'. | ||
| 608 | |||
| 609 | Returns a programmer-readable explanation of why A and B are not | ||
| 610 | `ert-equal-including-properties', or nil if they are." | ||
| 611 | (if (not (equal a b)) | 588 | (if (not (equal a b)) |
| 612 | (ert--explain-equal a b) | 589 | (ert--explain-equal a b) |
| 613 | (cl-assert (stringp a) t) | 590 | (cl-assert (stringp a) t) |
| @@ -629,15 +606,17 @@ Returns a programmer-readable explanation of why A and B are not | |||
| 629 | ,(ert--abbreviate-string | 606 | ,(ert--abbreviate-string |
| 630 | (substring-no-properties a (1+ i)) | 607 | (substring-no-properties a (1+ i)) |
| 631 | 10 nil)))) | 608 | 10 nil)))) |
| 632 | ;; TODO(ohler): Get `equal-including-properties' fixed in | 609 | finally (cl-assert (equal-including-properties a b) t)))) |
| 633 | ;; Emacs, delete `ert-equal-including-properties', and | ||
| 634 | ;; re-enable this assertion. | ||
| 635 | ;;finally (cl-assert (equal-including-properties a b) t) | ||
| 636 | ))) | ||
| 637 | (put 'ert-equal-including-properties | ||
| 638 | 'ert-explainer | ||
| 639 | 'ert--explain-equal-including-properties) | ||
| 640 | 610 | ||
| 611 | (defun ert--explain-equal-including-properties (a b) | ||
| 612 | "Explainer function for `equal-including-properties'." | ||
| 613 | ;; Do a quick comparison in C to avoid running our expensive | ||
| 614 | ;; comparison when possible. | ||
| 615 | (if (equal-including-properties a b) | ||
| 616 | nil | ||
| 617 | (ert--explain-equal-including-properties-rec a b))) | ||
| 618 | (put 'equal-including-properties 'ert-explainer | ||
| 619 | 'ert--explain-equal-including-properties) | ||
| 641 | 620 | ||
| 642 | ;;; Implementation of `ert-info'. | 621 | ;;; Implementation of `ert-info'. |
| 643 | 622 | ||
| @@ -2787,6 +2766,12 @@ TRANSFORM will be called to get from before to after." | |||
| 2787 | (defvar ert-unload-hook ()) | 2766 | (defvar ert-unload-hook ()) |
| 2788 | (add-hook 'ert-unload-hook #'ert--unload-function) | 2767 | (add-hook 'ert-unload-hook #'ert--unload-function) |
| 2789 | 2768 | ||
| 2769 | ;;; Obsolete | ||
| 2770 | |||
| 2771 | (define-obsolete-function-alias 'ert-equal-including-properties | ||
| 2772 | #'equal-including-properties "29.1") | ||
| 2773 | (put 'ert-equal-including-properties 'ert-explainer | ||
| 2774 | 'ert--explain-equal-including-properties) | ||
| 2790 | 2775 | ||
| 2791 | (provide 'ert) | 2776 | (provide 'ert) |
| 2792 | 2777 | ||
diff --git a/test/lisp/emacs-lisp/ert-tests.el b/test/lisp/emacs-lisp/ert-tests.el index 39b7b475555..79576d24032 100644 --- a/test/lisp/emacs-lisp/ert-tests.el +++ b/test/lisp/emacs-lisp/ert-tests.el | |||
| @@ -695,35 +695,40 @@ This macro is used to test if macroexpansion in `should' works." | |||
| 695 | (should (equal (ert--abbreviate-string "bar" 0 t) ""))) | 695 | (should (equal (ert--abbreviate-string "bar" 0 t) ""))) |
| 696 | 696 | ||
| 697 | (ert-deftest ert-test-explain-equal-string-properties () | 697 | (ert-deftest ert-test-explain-equal-string-properties () |
| 698 | (should | 698 | (should-not (ert--explain-equal-including-properties-rec "foo" "foo")) |
| 699 | (equal (ert--explain-equal-including-properties #("foo" 0 1 (a b)) | 699 | (should-not (ert--explain-equal-including-properties-rec |
| 700 | "foo") | 700 | #("foo" 0 3 (a b)) |
| 701 | '(char 0 "f" | 701 | (propertize "foo" 'a 'b))) |
| 702 | (different-properties-for-key a (different-atoms b nil)) | 702 | (should-not (ert--explain-equal-including-properties-rec |
| 703 | context-before "" | 703 | #("foo" 0 3 (a b c d)) |
| 704 | context-after "oo"))) | 704 | (propertize "foo" 'a 'b 'c 'd))) |
| 705 | (should (equal (ert--explain-equal-including-properties | 705 | (should-not (ert--explain-equal-including-properties-rec |
| 706 | #("foo" 0 3 (a (t))) | ||
| 707 | (propertize "foo" 'a (list t)))) | ||
| 708 | |||
| 709 | (should (equal (ert--explain-equal-including-properties-rec | ||
| 710 | #("foo" 0 3 (a b c e)) | ||
| 711 | (propertize "foo" 'a 'b 'c 'd)) | ||
| 712 | '(char 0 "f" (different-properties-for-key c (different-atoms e d)) | ||
| 713 | context-before "" | ||
| 714 | context-after "oo"))) | ||
| 715 | (should (equal (ert--explain-equal-including-properties-rec | ||
| 716 | #("foo" 0 1 (a b)) | ||
| 717 | "foo") | ||
| 718 | '(char 0 "f" | ||
| 719 | (different-properties-for-key a (different-atoms b nil)) | ||
| 720 | context-before "" | ||
| 721 | context-after "oo"))) | ||
| 722 | (should (equal (ert--explain-equal-including-properties-rec | ||
| 706 | #("foo" 1 3 (a b)) | 723 | #("foo" 1 3 (a b)) |
| 707 | #("goo" 0 1 (c d))) | 724 | #("goo" 0 1 (c d))) |
| 708 | '(array-elt 0 (different-atoms (?f "#x66" "?f") | 725 | '(array-elt 0 (different-atoms (?f "#x66" "?f") |
| 709 | (?g "#x67" "?g"))))) | 726 | (?g "#x67" "?g"))))) |
| 710 | (should | 727 | (should (equal (ert--explain-equal-including-properties-rec |
| 711 | (equal (ert--explain-equal-including-properties | 728 | #("foo" 0 1 (a b c d) 1 3 (a b)) |
| 712 | #("foo" 0 1 (a b c d) 1 3 (a b)) | 729 | #("foo" 0 1 (c d a b) 1 2 (a foo))) |
| 713 | #("foo" 0 1 (c d a b) 1 2 (a foo))) | 730 | '(char 1 "o" (different-properties-for-key a (different-atoms b foo)) |
| 714 | '(char 1 "o" (different-properties-for-key a (different-atoms b foo)) | 731 | context-before "f" context-after "o")))) |
| 715 | context-before "f" context-after "o")))) | ||
| 716 | |||
| 717 | (ert-deftest ert-test-equal-including-properties () | ||
| 718 | (should (ert-equal-including-properties "foo" "foo")) | ||
| 719 | (should (ert-equal-including-properties #("foo" 0 3 (a b)) | ||
| 720 | (propertize "foo" 'a 'b))) | ||
| 721 | (should (ert-equal-including-properties #("foo" 0 3 (a b c d)) | ||
| 722 | (propertize "foo" 'a 'b 'c 'd))) | ||
| 723 | (should-not (ert-equal-including-properties #("foo" 0 3 (a b c e)) | ||
| 724 | (propertize "foo" 'a 'b 'c 'd))) | ||
| 725 | (should (ert-equal-including-properties #("foo" 0 3 (a (t))) | ||
| 726 | (propertize "foo" 'a (list t))))) | ||
| 727 | 732 | ||
| 728 | (ert-deftest ert-test-stats-set-test-and-result () | 733 | (ert-deftest ert-test-stats-set-test-and-result () |
| 729 | (let* ((test-1 (make-ert-test :name 'test-1 | 734 | (let* ((test-1 (make-ert-test :name 'test-1 |
diff --git a/test/lisp/emacs-lisp/ert-x-tests.el b/test/lisp/emacs-lisp/ert-x-tests.el index 9f40a18d343..1784934acb3 100644 --- a/test/lisp/emacs-lisp/ert-x-tests.el +++ b/test/lisp/emacs-lisp/ert-x-tests.el | |||
| @@ -90,10 +90,10 @@ | |||
| 90 | "foo baz"))) | 90 | "foo baz"))) |
| 91 | 91 | ||
| 92 | (ert-deftest ert-propertized-string () | 92 | (ert-deftest ert-propertized-string () |
| 93 | (should (ert-equal-including-properties | 93 | (should (equal-including-properties |
| 94 | (ert-propertized-string "a" '(a b) "b" '(c t) "cd") | 94 | (ert-propertized-string "a" '(a b) "b" '(c t) "cd") |
| 95 | #("abcd" 1 2 (a b) 2 4 (c t)))) | 95 | #("abcd" 1 2 (a b) 2 4 (c t)))) |
| 96 | (should (ert-equal-including-properties | 96 | (should (equal-including-properties |
| 97 | (ert-propertized-string "foo " '(face italic) "bar" " baz" nil | 97 | (ert-propertized-string "foo " '(face italic) "bar" " baz" nil |
| 98 | " quux") | 98 | " quux") |
| 99 | #("foo bar baz quux" 4 11 (face italic))))) | 99 | #("foo bar baz quux" 4 11 (face italic))))) |
| @@ -166,7 +166,7 @@ | |||
| 166 | "1 skipped")))) | 166 | "1 skipped")))) |
| 167 | (with-current-buffer buffer-name | 167 | (with-current-buffer buffer-name |
| 168 | (font-lock-mode 0) | 168 | (font-lock-mode 0) |
| 169 | (should (ert-equal-including-properties | 169 | (should (equal-including-properties |
| 170 | (ert-filter-string (buffer-string) | 170 | (ert-filter-string (buffer-string) |
| 171 | '("Started at:\\(.*\\)$" 1) | 171 | '("Started at:\\(.*\\)$" 1) |
| 172 | '("Finished at:\\(.*\\)$" 1)) | 172 | '("Finished at:\\(.*\\)$" 1)) |
| @@ -175,7 +175,7 @@ | |||
| 175 | ;; pretend we are. | 175 | ;; pretend we are. |
| 176 | (let ((noninteractive nil)) | 176 | (let ((noninteractive nil)) |
| 177 | (font-lock-mode 1)) | 177 | (font-lock-mode 1)) |
| 178 | (should (ert-equal-including-properties | 178 | (should (equal-including-properties |
| 179 | (ert-filter-string (buffer-string) | 179 | (ert-filter-string (buffer-string) |
| 180 | '("Started at:\\(.*\\)$" 1) | 180 | '("Started at:\\(.*\\)$" 1) |
| 181 | '("Finished at:\\(.*\\)$" 1)) | 181 | '("Finished at:\\(.*\\)$" 1)) |
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index a731a95ccf0..e83dd7c857b 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el | |||
| @@ -23,16 +23,16 @@ | |||
| 23 | 23 | ||
| 24 | (ert-deftest format-properties () | 24 | (ert-deftest format-properties () |
| 25 | ;; Bug #23730 | 25 | ;; Bug #23730 |
| 26 | (should (ert-equal-including-properties | 26 | (should (equal-including-properties |
| 27 | (format (propertize "%d" 'face '(:background "red")) 1) | 27 | (format (propertize "%d" 'face '(:background "red")) 1) |
| 28 | #("1" 0 1 (face (:background "red"))))) | 28 | #("1" 0 1 (face (:background "red"))))) |
| 29 | (should (ert-equal-including-properties | 29 | (should (equal-including-properties |
| 30 | (format (propertize "%2d" 'face '(:background "red")) 1) | 30 | (format (propertize "%2d" 'face '(:background "red")) 1) |
| 31 | #(" 1" 0 2 (face (:background "red"))))) | 31 | #(" 1" 0 2 (face (:background "red"))))) |
| 32 | (should (ert-equal-including-properties | 32 | (should (equal-including-properties |
| 33 | (format (propertize "%02d" 'face '(:background "red")) 1) | 33 | (format (propertize "%02d" 'face '(:background "red")) 1) |
| 34 | #("01" 0 2 (face (:background "red"))))) | 34 | #("01" 0 2 (face (:background "red"))))) |
| 35 | (should (ert-equal-including-properties | 35 | (should (equal-including-properties |
| 36 | (format (concat (propertize "%2d" 'x 'X) | 36 | (format (concat (propertize "%2d" 'x 'X) |
| 37 | (propertize "a" 'a 'A) | 37 | (propertize "a" 'a 'A) |
| 38 | (propertize "b" 'b 'B)) | 38 | (propertize "b" 'b 'B)) |
| @@ -40,27 +40,27 @@ | |||
| 40 | #(" 1ab" 0 2 (x X) 2 3 (a A) 3 4 (b B)))) | 40 | #(" 1ab" 0 2 (x X) 2 3 (a A) 3 4 (b B)))) |
| 41 | 41 | ||
| 42 | ;; Bug #5306 | 42 | ;; Bug #5306 |
| 43 | (should (ert-equal-including-properties | 43 | (should (equal-including-properties |
| 44 | (format "%.10s" | 44 | (format "%.10s" |
| 45 | (concat "1234567890aaaa" | 45 | (concat "1234567890aaaa" |
| 46 | (propertize "12345678901234567890" 'xxx 25))) | 46 | (propertize "12345678901234567890" 'xxx 25))) |
| 47 | "1234567890")) | 47 | "1234567890")) |
| 48 | (should (ert-equal-including-properties | 48 | (should (equal-including-properties |
| 49 | (format "%.10s" | 49 | (format "%.10s" |
| 50 | (concat "123456789" | 50 | (concat "123456789" |
| 51 | (propertize "12345678901234567890" 'xxx 25))) | 51 | (propertize "12345678901234567890" 'xxx 25))) |
| 52 | #("1234567891" 9 10 (xxx 25)))) | 52 | #("1234567891" 9 10 (xxx 25)))) |
| 53 | 53 | ||
| 54 | ;; Bug #23859 | 54 | ;; Bug #23859 |
| 55 | (should (ert-equal-including-properties | 55 | (should (equal-including-properties |
| 56 | (format "%4s" (propertize "hi" 'face 'bold)) | 56 | (format "%4s" (propertize "hi" 'face 'bold)) |
| 57 | #(" hi" 2 4 (face bold)))) | 57 | #(" hi" 2 4 (face bold)))) |
| 58 | 58 | ||
| 59 | ;; Bug #23897 | 59 | ;; Bug #23897 |
| 60 | (should (ert-equal-including-properties | 60 | (should (equal-including-properties |
| 61 | (format "%s" (concat (propertize "01234" 'face 'bold) "56789")) | 61 | (format "%s" (concat (propertize "01234" 'face 'bold) "56789")) |
| 62 | #("0123456789" 0 5 (face bold)))) | 62 | #("0123456789" 0 5 (face bold)))) |
| 63 | (should (ert-equal-including-properties | 63 | (should (equal-including-properties |
| 64 | (format "%s" (concat (propertize "01" 'face 'bold) | 64 | (format "%s" (concat (propertize "01" 'face 'bold) |
| 65 | (propertize "23" 'face 'underline) | 65 | (propertize "23" 'face 'underline) |
| 66 | "45")) | 66 | "45")) |
| @@ -68,63 +68,63 @@ | |||
| 68 | ;; The last property range is extended to include padding on the | 68 | ;; The last property range is extended to include padding on the |
| 69 | ;; right, but the first range is not extended to the left to include | 69 | ;; right, but the first range is not extended to the left to include |
| 70 | ;; padding on the left! | 70 | ;; padding on the left! |
| 71 | (should (ert-equal-including-properties | 71 | (should (equal-including-properties |
| 72 | (format "%12s" (concat (propertize "01234" 'face 'bold) "56789")) | 72 | (format "%12s" (concat (propertize "01234" 'face 'bold) "56789")) |
| 73 | #(" 0123456789" 2 7 (face bold)))) | 73 | #(" 0123456789" 2 7 (face bold)))) |
| 74 | (should (ert-equal-including-properties | 74 | (should (equal-including-properties |
| 75 | (format "%-12s" (concat (propertize "01234" 'face 'bold) "56789")) | 75 | (format "%-12s" (concat (propertize "01234" 'face 'bold) "56789")) |
| 76 | #("0123456789 " 0 5 (face bold)))) | 76 | #("0123456789 " 0 5 (face bold)))) |
| 77 | (should (ert-equal-including-properties | 77 | (should (equal-including-properties |
| 78 | (format "%10s" (concat (propertize "01" 'face 'bold) | 78 | (format "%10s" (concat (propertize "01" 'face 'bold) |
| 79 | (propertize "23" 'face 'underline) | 79 | (propertize "23" 'face 'underline) |
| 80 | "45")) | 80 | "45")) |
| 81 | #(" 012345" 4 6 (face bold) 6 8 (face underline)))) | 81 | #(" 012345" 4 6 (face bold) 6 8 (face underline)))) |
| 82 | (should (ert-equal-including-properties | 82 | (should (equal-including-properties |
| 83 | (format "%-10s" (concat (propertize "01" 'face 'bold) | 83 | (format "%-10s" (concat (propertize "01" 'face 'bold) |
| 84 | (propertize "23" 'face 'underline) | 84 | (propertize "23" 'face 'underline) |
| 85 | "45")) | 85 | "45")) |
| 86 | #("012345 " 0 2 (face bold) 2 4 (face underline)))) | 86 | #("012345 " 0 2 (face bold) 2 4 (face underline)))) |
| 87 | (should (ert-equal-including-properties | 87 | (should (equal-including-properties |
| 88 | (format "%-10s" (concat (propertize "01" 'face 'bold) | 88 | (format "%-10s" (concat (propertize "01" 'face 'bold) |
| 89 | (propertize "23" 'face 'underline) | 89 | (propertize "23" 'face 'underline) |
| 90 | (propertize "45" 'face 'italic))) | 90 | (propertize "45" 'face 'italic))) |
| 91 | #("012345 " | 91 | #("012345 " |
| 92 | 0 2 (face bold) 2 4 (face underline) 4 10 (face italic)))) | 92 | 0 2 (face bold) 2 4 (face underline) 4 10 (face italic)))) |
| 93 | ;; Bug #38191 | 93 | ;; Bug #38191 |
| 94 | (should (ert-equal-including-properties | 94 | (should (equal-including-properties |
| 95 | (format (propertize "‘foo’ %s bar" 'face 'bold) "xxx") | 95 | (format (propertize "‘foo’ %s bar" 'face 'bold) "xxx") |
| 96 | #("‘foo’ xxx bar" 0 13 (face bold)))) | 96 | #("‘foo’ xxx bar" 0 13 (face bold)))) |
| 97 | ;; Bug #32404 | 97 | ;; Bug #32404 |
| 98 | (should (ert-equal-including-properties | 98 | (should (equal-including-properties |
| 99 | (format (concat (propertize "%s" 'face 'bold) | 99 | (format (concat (propertize "%s" 'face 'bold) |
| 100 | "" | 100 | "" |
| 101 | (propertize "%s" 'face 'error)) | 101 | (propertize "%s" 'face 'error)) |
| 102 | "foo" "bar") | 102 | "foo" "bar") |
| 103 | #("foobar" 0 3 (face bold) 3 6 (face error)))) | 103 | #("foobar" 0 3 (face bold) 3 6 (face error)))) |
| 104 | (should (ert-equal-including-properties | 104 | (should (equal-including-properties |
| 105 | (format (concat "%s" (propertize "%s" 'face 'error)) "foo" "bar") | 105 | (format (concat "%s" (propertize "%s" 'face 'error)) "foo" "bar") |
| 106 | #("foobar" 3 6 (face error)))) | 106 | #("foobar" 3 6 (face error)))) |
| 107 | (should (ert-equal-including-properties | 107 | (should (equal-including-properties |
| 108 | (format (concat "%s " (propertize "%s" 'face 'error)) "foo" "bar") | 108 | (format (concat "%s " (propertize "%s" 'face 'error)) "foo" "bar") |
| 109 | #("foo bar" 4 7 (face error)))) | 109 | #("foo bar" 4 7 (face error)))) |
| 110 | ;; Bug #46317 | 110 | ;; Bug #46317 |
| 111 | (let ((s (propertize "X" 'prop "val"))) | 111 | (let ((s (propertize "X" 'prop "val"))) |
| 112 | (should (ert-equal-including-properties | 112 | (should (equal-including-properties |
| 113 | (format (concat "%3s/" s) 12) | 113 | (format (concat "%3s/" s) 12) |
| 114 | #(" 12/X" 4 5 (prop "val")))) | 114 | #(" 12/X" 4 5 (prop "val")))) |
| 115 | (should (ert-equal-including-properties | 115 | (should (equal-including-properties |
| 116 | (format (concat "%3S/" s) 12) | 116 | (format (concat "%3S/" s) 12) |
| 117 | #(" 12/X" 4 5 (prop "val")))) | 117 | #(" 12/X" 4 5 (prop "val")))) |
| 118 | (should (ert-equal-including-properties | 118 | (should (equal-including-properties |
| 119 | (format (concat "%3d/" s) 12) | 119 | (format (concat "%3d/" s) 12) |
| 120 | #(" 12/X" 4 5 (prop "val")))) | 120 | #(" 12/X" 4 5 (prop "val")))) |
| 121 | (should (ert-equal-including-properties | 121 | (should (equal-including-properties |
| 122 | (format (concat "%-3s/" s) 12) | 122 | (format (concat "%-3s/" s) 12) |
| 123 | #("12 /X" 4 5 (prop "val")))) | 123 | #("12 /X" 4 5 (prop "val")))) |
| 124 | (should (ert-equal-including-properties | 124 | (should (equal-including-properties |
| 125 | (format (concat "%-3S/" s) 12) | 125 | (format (concat "%-3S/" s) 12) |
| 126 | #("12 /X" 4 5 (prop "val")))) | 126 | #("12 /X" 4 5 (prop "val")))) |
| 127 | (should (ert-equal-including-properties | 127 | (should (equal-including-properties |
| 128 | (format (concat "%-3d/" s) 12) | 128 | (format (concat "%-3d/" s) 12) |
| 129 | #("12 /X" 4 5 (prop "val")))))) | 129 | #("12 /X" 4 5 (prop "val")))))) |
| 130 | 130 | ||