summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormallt <mallt@users.noreply.github.com>2016-05-30 00:21:35 +0200
committerBozhidar Batsov <bozhidar.batsov@gmail.com>2016-05-30 01:21:35 +0300
commitfca597a2964fd13cfba17220ebf45786502d8f1c (patch)
tree82fab0cf16f5acd405b344c2b531fe6b6068a775 /test
parentafd5549baa005b9f7ad5652f18288f8a37ade306 (diff)
[Fix #1577] Show first line of docstring in ns browser (#1757)
Diffstat (limited to 'test')
-rw-r--r--test/cider-browse-ns-tests.el25
1 files changed, 23 insertions, 2 deletions
diff --git a/test/cider-browse-ns-tests.el b/test/cider-browse-ns-tests.el
index b6cd538d..317bcce2 100644
--- a/test/cider-browse-ns-tests.el
+++ b/test/cider-browse-ns-tests.el
@@ -47,7 +47,9 @@
:var (cider-browse-ns-buffer)
(it "lists out all forms of a namespace with correct font-locks"
(spy-on 'cider-sync-request:ns-vars-with-meta :and-return-value
- '(dict "blank?" (dict "arglists" "fn arg list")))
+ '(dict "blank?"
+ (dict "arglists" "fn arg list"
+ "doc" "\"True if s is nil, empty, or contains only whitespace.\"")))
(with-temp-buffer
(setq cider-browse-ns-buffer (buffer-name (current-buffer)))
@@ -55,4 +57,23 @@
(search-forward "clojure")
(expect (get-text-property (point) 'face) :to-equal 'font-lock-type-face)
(search-forward "blank")
- (expect (get-text-property (point) 'font-lock-face) :to-equal 'font-lock-function-name-face))))
+ (expect (get-text-property (point) 'font-lock-face) :to-equal 'font-lock-function-name-face)
+ (search-forward "True")
+ (expect (get-text-property (point) 'font-lock-face) :to-equal 'font-lock-doc-face))))
+
+(describe "cider-browse-ns--first-doc-line"
+ (it "returns Not documented if the doc string is missing"
+ (expect (cider-browse-ns--first-doc-line nil)
+ :to-equal "Not documented."))
+
+ (it "returns the first line of the doc string"
+ (expect (cider-browse-ns--first-doc-line "\"True if s is nil, empty, or contains only whitespace.\"")
+ :to-equal "True if s is nil, empty, or contains only whitespace."))
+
+ (it "returns the first sentence of the doc string if the first line contains multiple sentences"
+ (expect (cider-browse-ns--first-doc-line "\"First sentence. Second sentence.\"")
+ :to-equal "First sentence. "))
+
+ (it "returns the first line of the doc string if the first sentence spans multiple lines"
+ (expect (cider-browse-ns--first-doc-line "\"True if s is nil, empty, or\n contains only whitespace.\"")
+ :to-equal "True if s is nil, empty, or...")))