summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVedang Manerikar <ved.manerikar@gmail.com>2013-08-14 15:38:47 +0530
committerVedang Manerikar <ved.manerikar@gmail.com>2013-08-18 11:26:34 +0530
commit831ee803cddb34e0a0a20542c31ff2710b5ff341 (patch)
treeaf0ecfb2d09e7d2957126765c6dbc883ad83e970 /test
parent6092b7a469c37e2473c8181fe10c11f0a56a6414 (diff)
Show port along with project name in `nrepl-repl-buffer-name'
- Add tests for new `port-in-nrepl-repl-buffer-name' functionality - Add documentation about displaying port name in nrepl-repl-buffer-name
Diffstat (limited to 'test')
-rw-r--r--test/nrepl-tests.el44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/nrepl-tests.el b/test/nrepl-tests.el
index 2f4c10ed..fd03766a 100644
--- a/test/nrepl-tests.el
+++ b/test/nrepl-tests.el
@@ -374,6 +374,31 @@
(should
(equal (nrepl-repl-buffer-name) "*nreplXproj*"))))))
+(ert-deftest test-nrepl-clojure-buffer-name-show-port-t ()
+ (with-temp-buffer
+ (set (make-local-variable 'nrepl-buffer-name-show-port) t)
+ (set (make-local-variable 'nrepl-endpoint) '("localhost" 4009))
+ (let ((nrepl-connection-list (list (buffer-name (current-buffer)))))
+ (should
+ (equal (nrepl-repl-buffer-name) "*nrepl:4009*")))))
+
+(ert-deftest test-nrepl-clojure-buffer-name-show-port-nil ()
+ (with-temp-buffer
+ (set (make-local-variable 'nrepl-buffer-name-show-port) nil)
+ (set (make-local-variable 'nrepl-endpoint) '("localhost" 4009))
+ (let ((nrepl-connection-list (list (buffer-name (current-buffer)))))
+ (should
+ (equal (nrepl-repl-buffer-name) "*nrepl*")))))
+
+(ert-deftest test-nrepl-clojure-buffer-name-based-on-project-and-port ()
+ (with-temp-buffer
+ (set (make-local-variable 'nrepl-buffer-name-show-port) t)
+ (set (make-local-variable 'nrepl-project-dir) "proj")
+ (set (make-local-variable 'nrepl-endpoint) '("localhost" 4009))
+ (let ((nrepl-connection-list (list (buffer-name (current-buffer)))))
+ (should
+ (equal (nrepl-repl-buffer-name) "*nrepl proj:4009*")))))
+
(ert-deftest test-nrepl-clojure-buffer-name-two-buffers-same-project ()
(with-temp-buffer
(set (make-local-variable 'nrepl-project-dir) "proj")
@@ -392,3 +417,22 @@
(ert-deftest test-nrepl--find-rest-args-position ()
(should (= (nrepl--find-rest-args-position [fmt & arg]) 1))
(should (equal (nrepl--find-rest-args-position [fmt arg]) nil)))
+
+(ert-deftest test-nrepl-clojure-buffer-name-duplicate-proj-port ()
+ (with-temp-buffer
+ (set (make-local-variable 'nrepl-buffer-name-show-port) t)
+ (set (make-local-variable 'nrepl-project-dir) "proj")
+ (set (make-local-variable 'nrepl-endpoint) '("localhost" 4009))
+ (let* ((nrepl-connection-list (list (buffer-name (current-buffer))))
+ (nrepl-new-buffer (nrepl-repl-buffer-name)))
+ (get-buffer-create nrepl-new-buffer)
+ (should
+ (equal nrepl-new-buffer "*nrepl proj:4009*"))
+ (with-temp-buffer
+ (set (make-local-variable 'nrepl-buffer-name-show-port) t)
+ (set (make-local-variable 'nrepl-project-dir) "proj")
+ (set (make-local-variable 'nrepl-endpoint) '("localhost" 4009))
+ (let ((nrepl-connection-list (list (buffer-name (current-buffer)))))
+ (should
+ (equal (nrepl-repl-buffer-name) "*nrepl proj:4009*<2>")))
+ (kill-buffer nrepl-new-buffer)))))