File: lsp-ui-doc-test.el

package info (click to toggle)
emacs-lsp-ui 9.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,088 kB
  • sloc: lisp: 3,066; makefile: 34
file content (58 lines) | stat: -rw-r--r-- 1,598 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
;; -*- lexical-binding: t -*-


(require 'lsp-ui-doc)

(ert-deftest lsp-ui-doc--make-smaller-empty-lines ()
  "Test if `lsp-ui-doc--make-smaller-empty-lines' correctly replaces lines"
  (let ((string "This is a test

It will show it will shrink empty lines
"))
    (with-temp-buffer
      (insert string)
      (lsp-ui-doc--make-smaller-empty-lines)
      (should (ert-equal-including-properties
               #("
This is a test
  
It will show it will shrink empty lines


"
                 0 1 (face (:height 0.3))
                 16 17 (face (:height 0.1))
                 17 18 (face (:height 0.2))
                 18 19 (face (:height 0.4))
                 59 61 (face (:height 0.3)))
               (buffer-substring (point-min) (point-max)))))))


(ert-deftest lsp-ui-doc--handle-hr-lines ()
  "Test if `lsp-ui-doc--handle-hr-lines' correctly replaces markdown hrules"
  (let ((string "Before

---
Text

---
After"))
    (with-temp-buffer
      (insert string)
      (markdown-mode)
      (lsp-ui-doc--handle-hr-lines)
      (should (ert-equal-including-properties
               #("Before

   
Text

   
After"
                 8 9 (display (space :height (1)) lsp-ui-doc--replace-hr t face (:background "dark grey"))
                 9 10 (display (space :height (1)))
                 10 12 (face (:height 0.2))
                 18 19 (display (space :height (1)) lsp-ui-doc--replace-hr t face (:background "dark grey"))
                 19 20 (display (space :height (1)))
                 20 22 (face (:height 0.2)))
               (buffer-substring (point-min) (point-max)))))))