emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/cider 4ce7e80bda: [#3018] Introduce a custom cider--pkg-ve


From: ELPA Syncer
Subject: [nongnu] elpa/cider 4ce7e80bda: [#3018] Introduce a custom cider--pkg-version
Date: Wed, 5 Jan 2022 00:57:51 -0500 (EST)

branch: elpa/cider
commit 4ce7e80bda7537717c66b451022a1350805c2ac0
Author: Bozhidar Batsov <bozhidar@batsov.dev>
Commit: Bozhidar Batsov <bozhidar@batsov.dev>

    [#3018] Introduce a custom cider--pkg-version
    
    We'll have to flesh it out, but at least it should fix the unit test
    failures related to package-get-version being an inlined function that
    can't be stubbed by spy-on.
---
 cider-util.el            | 11 ++++++++---
 test/cider-util-tests.el |  2 +-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/cider-util.el b/cider-util.el
index 2599d5d652..ffa9dace88 100644
--- a/cider-util.el
+++ b/cider-util.el
@@ -374,13 +374,18 @@ propertized (defaults to current buffer)."
 (defvar cider-version)
 (defvar cider-codename)
 
+(defun cider--pkg-version ()
+  "Extact CIDER's package version from its package metadata."
+  ;; FIXME: Inline the logic from package-get-version and adapt it
+  (if (fboundp 'package-get-version)
+      (package-get-version)
+    nil))
+
 (defun cider--version ()
   "Retrieve CIDER's version.
 A codename is added to stable versions."
   (if (string-match-p "-snapshot" cider-version)
-      (let ((pkg-version (if (fboundp 'package-get-version)
-                             (package-get-version)
-                           nil)))
+      (let ((pkg-version (cider--pkg-version)))
         (if pkg-version
             ;; snapshot versions include the MELPA package version
             (format "%s (package: %s)" cider-version pkg-version)
diff --git a/test/cider-util-tests.el b/test/cider-util-tests.el
index 4ecceb20a1..0f4c6a2f4e 100644
--- a/test/cider-util-tests.el
+++ b/test/cider-util-tests.el
@@ -59,7 +59,7 @@ buffer."
   (it "handles snapshot versions"
     (setq cider-version "0.11.0-snapshot"
           cider-codename "Victory")
-    (spy-on 'package-get-version :and-return-value "20160301.2217")
+    (spy-on 'cider--pkg-version :and-return-value "20160301.2217")
     (expect (cider--version) :to-equal "0.11.0-snapshot (package: 
20160301.2217)")))
 
 (defvar some-cider-hook)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]