Skip to content

Commit

Permalink
Hotfix, add missing version check
Browse files Browse the repository at this point in the history
  • Loading branch information
minad committed Jan 5, 2023
1 parent 5288604 commit 06d0369
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 26 deletions.
2 changes: 2 additions & 0 deletions compat-macs.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
58 changes: 32 additions & 26 deletions compat-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"))
Expand Down

0 comments on commit 06d0369

Please sign in to comment.