branch: externals/compat commit 06d0369d6c5e78e729e6a2f15584360f6e03cf44 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
Hotfix, add missing version check --- compat-macs.el | 2 ++ compat-tests.el | 58 +++++++++++++++++++++++++++++++-------------------------- 2 files changed, 34 insertions(+), 26 deletions(-) diff --git a/compat-macs.el b/compat-macs.el index 0293111190..8172ec995e 100644 --- a/compat-macs.el +++ b/compat-macs.el @@ -98,6 +98,8 @@ ignored: nil) ((plist-get attr :explicit) t) + ((and (version<= compat--current-version emacs-version) (not cond)) + nil) ((and (if cond (eval cond t) t) (funcall check-fn))))) (cond diff --git a/compat-tests.el b/compat-tests.el index 25845e7e08..f7e4f00160 100644 --- a/compat-tests.el +++ b/compat-tests.el @@ -867,19 +867,22 @@ 1)) (should (equal (buffer-string) "new bar zot foobar"))) - (with-temp-buffer - (insert "foo bar baz") - (should (= (replace-string-in-region "ba" "quux corge grault" (point-min)) - 2)) - (should (equal (buffer-string) - "foo quux corge graultr quux corge graultz"))) - - (with-temp-buffer - (insert "foo bar bar") - (should (= (replace-string-in-region " bar" "" (point-min) 8) - 1)) - (should (equal (buffer-string) - "foo bar")))) + ;; There was a bug in the Emacs 28 implementation + ;; Fixed in Emacs d8f392bccd46cdb238ec96964f220ffb9d81cc44 + (unless (= emacs-major-version 28) + (with-temp-buffer + (insert "foo bar baz") + (should (= (replace-string-in-region "ba" "quux corge grault" (point-min)) + 2)) + (should (equal (buffer-string) + "foo quux corge graultr quux corge graultz"))) + + (with-temp-buffer + (insert "foo bar bar") + (should (= (replace-string-in-region " bar" "" (point-min) 8) + 1)) + (should (equal (buffer-string) + "foo bar"))))) (ert-deftest replace-regexp-in-region () (with-temp-buffer @@ -904,19 +907,22 @@ 1)) (should (equal (buffer-string) "new bar zot foobar"))) - (with-temp-buffer - (insert "foo bar baz") - (should (= (replace-regexp-in-region "ba." "quux corge grault" (point-min)) - 2)) - (should (equal (buffer-string) - "foo quux corge grault quux corge grault"))) - - (with-temp-buffer - (insert "foo bar bar") - (should (= (replace-regexp-in-region " bar" "" (point-min) 8) - 1)) - (should (equal (buffer-string) - "foo bar")))) + ;; There was a bug in the Emacs 28 implementation + ;; Fixed in Emacs d8f392bccd46cdb238ec96964f220ffb9d81cc44 + (unless (= emacs-major-version 28) + (with-temp-buffer + (insert "foo bar baz") + (should (= (replace-regexp-in-region "ba." "quux corge grault" (point-min)) + 2)) + (should (equal (buffer-string) + "foo quux corge grault quux corge grault"))) + + (with-temp-buffer + (insert "foo bar bar") + (should (= (replace-regexp-in-region " bar" "" (point-min) 8) + 1)) + (should (equal (buffer-string) + "foo bar"))))) (ert-deftest string-split () (should-equal '("a" "b" "c") (split-string "a b c"))