diff options
author | Bozhidar Batsov <bozhidar@batsov.com> | 2016-03-02 23:21:48 +0200 |
---|---|---|
committer | Bozhidar Batsov <bozhidar@batsov.com> | 2016-03-02 23:21:48 +0200 |
commit | 973ba343cb43c17ff98c726db61f58d47830cf00 (patch) | |
tree | b1f2c79505e524ec310cea282f183df009efd44b | |
parent | cbd0666ab65936646833ce7f4f1b7cb44c65a2fe (diff) |
Introduce codenames for stable releases
-rw-r--r-- | cider-util.el | 12 | ||||
-rw-r--r-- | cider.el | 3 | ||||
-rw-r--r-- | test/cider-tests.el | 15 | ||||
-rw-r--r-- | test/cider-util-tests.el | 19 |
4 files changed, 39 insertions, 10 deletions
diff --git a/cider-util.el b/cider-util.el index df6db9b5..9c92f2ab 100644 --- a/cider-util.el +++ b/cider-util.el @@ -285,10 +285,14 @@ Unless you specify a BUFFER it will default to the current one." (defvar cider-version) (defun cider--version () - "Retrieve CIDER's version." - (condition-case nil - (pkg-info-version-info 'cider) - (error cider-version))) + "Retrieve CIDER's version. +A codename is added to stable versions." + (let ((version (condition-case nil + (pkg-info-version-info 'cider) + (error cider-version)))) + (if (string-match-p "-snapshot" cider-version) + version + (format "%s (%s)" version cider-codename)))) ;;; Strings @@ -91,6 +91,9 @@ project inference will take place." Normally it won't be used, unless `pkg-info' fails to extract the version from the CIDER package or library.") +(defconst cider-codename "Bulgaria" + "Codename used to denote stable releases.") + (defcustom cider-lein-command "lein" "The command used to execute Leiningen." diff --git a/test/cider-tests.el b/test/cider-tests.el index 1a75481c..c0532abe 100644 --- a/test/cider-tests.el +++ b/test/cider-tests.el @@ -144,16 +144,18 @@ (cider--nrepl-version () "0.2.12") (cider--connection-host (conn) "localhost") (cider--connection-port (conn) "54018")) - (should (equal (cider-repl--banner) - ";; Connected to nREPL server running on port 54018 on host localhost - nrepl://localhost:54018 -;; CIDER 0.11.0, nREPL 0.2.12 + (let ((cider-version "0.11.0") + (cider-codename "Victory")) + (should (equal (cider-repl--banner) + ";; Connected to nREPL server running on port 54018 on host localhost - nrepl://localhost:54018 +;; CIDER 0.11.0 (Victory), nREPL 0.2.12 ;; Clojure 1.8.0, Java 1.8.0_31 ;; Docs: (doc function-name) ;; (find-doc part-of-name) ;; Source: (source function-name) ;; Javadoc: (javadoc java-object-or-class) ;; Exit: C-c C-q -;; Results: Stored in vars *1, *2, *3, an exception in *e;")))) +;; Results: Stored in vars *1, *2, *3, an exception in *e;"))))) (ert-deftest test-cider-repl--banner-version-fallback () (noflet ((pkg-info-version-info (library) (error "No package version")) @@ -162,10 +164,11 @@ (cider--nrepl-version () "0.2.12") (cider--connection-host (conn) "localhost") (cider--connection-port (conn) "54018")) - (let ((cider-version "0.11.0")) + (let ((cider-version "0.11.0") + (cider-codename "Victory")) (should (equal (cider-repl--banner) ";; Connected to nREPL server running on port 54018 on host localhost - nrepl://localhost:54018 -;; CIDER 0.11.0, nREPL 0.2.12 +;; CIDER 0.11.0 (Victory), nREPL 0.2.12 ;; Clojure 1.8.0, Java 1.8.0_31 ;; Docs: (doc function-name) ;; (find-doc part-of-name) diff --git a/test/cider-util-tests.el b/test/cider-util-tests.el index 0ea18864..adfb8881 100644 --- a/test/cider-util-tests.el +++ b/test/cider-util-tests.el @@ -1,6 +1,7 @@ (require 'cider) (require 'cider-util) (require 'ert) +(require 'noflet) ;;; cider-util tests (ert-deftest cider-symbol-at-point-dont-move () @@ -10,3 +11,21 @@ (should (not (cider-symbol-at-point))) (should (equal "else" (cider-symbol-at-point 'lookback))) (should (= (point) (point-max))))) + +(ert-deftest cider--version-fallback () + (noflet ((pkg-info-version-info (package) (error "No version"))) + (let ((cider-version "0.11.0") + (cider-codename "Victory")) + (should (string= (cider--version) "0.11.0 (Victory)"))))) + +(ert-deftest cider--version-stable-version () + (noflet ((pkg-info-version-info (package) "0.11.0")) + (let ((cider-version "0.11.0") + (cider-codename "Victory")) + (should (string= (cider--version) "0.11.0 (Victory)"))))) + +(ert-deftest cider--version-snapshot-version () + (noflet ((pkg-info-version-info (package) "0.11.0snapshot (package: 20160301.2217)")) + (let ((cider-version "0.11.0-snapshot") + (cider-codename "Victory")) + (should (string= (cider--version) "0.11.0snapshot (package: 20160301.2217)"))))) |