[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat 5e7698c 45/99: Avoid testing advice compatibilit
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat 5e7698c 45/99: Avoid testing advice compatibility in version to old to compare |
Date: |
Sun, 17 Oct 2021 05:57:54 -0400 (EDT) |
branch: externals/compat
commit 5e7698cd1035fce166bdea2a8f181e1c569254df
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>
Avoid testing advice compatibility in version to old to compare
A function may be bound but that doesn't mean it implements the
behaviour we are testing. These modifications ensure that the tests
only run when the version guarantees the expected behaviour.
---
compat-macs.el | 12 ++++++++----
compat-tests.el | 12 +++++++++---
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/compat-macs.el b/compat-macs.el
index 2c00f68..63604e8 100644
--- a/compat-macs.el
+++ b/compat-macs.el
@@ -29,7 +29,7 @@
"Ignore all arguments."
nil)
-(defun compat-generate-common (name def-fn install-fn check-fn attr)
+(defun compat-generate-common (name def-fn install-fn check-fn attr type)
"Common code for generating compatibility definitions for NAME.
The resulting body is constructed by invoking the functions
DEF-FN (passed the \"realname\" and the version number, returning
@@ -59,7 +59,9 @@ attributes are handled, all others are ignored:
code was defined in (string).
- :realname :: Manual specification of a \"realname\" to use for
- the compatibility definition (symbol)."
+ the compatibility definition (symbol).
+
+TYPE is used to set the symbol property `compat-type' for NAME."
(let* ((min-version (plist-get attr :min-version))
(max-version (plist-get attr :max-version))
(feature (plist-get attr :feature))
@@ -96,6 +98,8 @@ attributes are handled, all others are ignored:
1 font-lock-preprocessor-face prepend))))
,(funcall install-fn realname))))
`(progn
+ (put ',realname 'compat-type ',type)
+ (put ',realname 'compat-version ,version)
,(funcall def-fn realname version)
,(if feature
`(eval-after-load ',feature (lambda () ,body))
@@ -162,7 +166,7 @@ attributes (see `compat-generate-common')."
((memq type '(func macro))
`(fboundp ',name))
((eq type 'advice) t)))
- rest)))
+ rest type)))
(defmacro compat-defun (name arglist docstring &rest rest)
"Define NAME with arguments ARGLIST as a compatibility function.
@@ -247,7 +251,7 @@ non-nil value."
`(defvaralias ',name ',realname))
(lambda ()
`(boundp ',name))
- attr))
+ attr 'variable))
(provide 'compat-macs)
;;; compat-macs.el ends here
diff --git a/compat-tests.el b/compat-tests.el
index 1b41cbb..02a3cb6 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -96,7 +96,10 @@
(macroexp-progn
(list
`(should (equal (funcall (apply-partially #',cfn #',rfn) ,@input)
,result))
- (and (fboundp rfn)
+ (and (and (fboundp rfn)
+ (or (not (eq (get cfn 'compat-type) 'advice))
+ (not (get cfn 'compat-version))
+ (version<= (get cfn 'compat-version) emacs-version)))
`(should (equal (,rfn ,@input) ,result)))))))
(defmacro compat--mshould (result &rest input)
@@ -129,7 +132,10 @@
(macroexp-progn
(list
`(should-error (funcall (apply-partially #',cfn #',rfn) ,@input) :type
',error)
- (and (fboundp rfn)
+ (and (and (fboundp rfn)
+ (or (not (eq (get cfn 'compat-type) 'advice))
+ (not (get cfn 'compat-version))
+ (version<= (get cfn 'compat-version) emacs-version)))
`(should-error (,rfn ,@input) :type ',error))))))
;; FIXME: extract the name of the test out of the ERT-test, instead
@@ -560,7 +566,7 @@ the compatibility function."
;; Test empty list:
(compat--should* "\\(?:\\`a\\`\\)" '())
(compat--should* "\\<\\(\\`a\\`\\)\\>" '() 'words))
- (let ((unmatchable (regexp-opt '())))
+ (let ((unmatchable (compat--regexp-opt #'regexp-opt '())))
(dolist (str '("" ;empty string
"a" ;simple string
"aaa" ;longer string
- [elpa] externals/compat a46ab78 19/99: Add button-buttonize to emacs-28.1, (continued)
- [elpa] externals/compat a46ab78 19/99: Add button-buttonize to emacs-28.1, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 9c6818c 20/99: Add directory-name-p compatibility function, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 070384b 24/99: Fix compat-tests for older versions, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 05092cb 25/99: Fix compat-test indentation in compat-tests, ELPA Syncer, 2021/10/17
- [elpa] externals/compat cb339dd 31/99: Add :cond where applicable, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 2d50e5c 32/99: Implement func-arity, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 36ef438 35/99: Implement and use mounted-file-systems, ELPA Syncer, 2021/10/17
- [elpa] externals/compat e5a573f 37/99: Declare mouse-set-point, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 2089c90 41/99: Declare gensym for with-existing-directory, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 2faab78 42/99: Add debug specification for setq-local, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 5e7698c 45/99: Avoid testing advice compatibility in version to old to compare,
ELPA Syncer <=
- [elpa] externals/compat 343bcbb 46/99: Fix if-let implementation, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 32031ea 50/99: Remove unnecessary compat-- prefix from gensym-counter, ELPA Syncer, 2021/10/17
- [elpa] externals/compat f8f4a9f 52/99: Use right function in some compat-maxargs-/= invocations, ELPA Syncer, 2021/10/17
- [elpa] externals/compat fa09ea0 54/99: Factor out multibyte regexp tests for string-search and -replace, ELPA Syncer, 2021/10/17
- [elpa] externals/compat aa112d8 63/99: Implement lookup-key handling of keymap lists, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 86fb58f 64/99: Move compat--alist-get-full-elisp to emacs-25.1, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 954c97b 67/99: Update compat-tests header, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 5cd751b 68/99: Mention GitHub issue tracker in README, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 598a040 69/99: Add :cond check to lookup-key, ELPA Syncer, 2021/10/17
- [elpa] externals/compat b16122b 71/99: Use explicit symbol names instead of alii, ELPA Syncer, 2021/10/17