File: test-fill.el

package info (click to toggle)
lua-mode 20151025-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 240 kB
  • ctags: 145
  • sloc: lisp: 2,533; makefile: 34; sh: 26
file content (40 lines) | stat: -rw-r--r-- 1,272 bytes parent folder | download | duplicates (2)
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
;; -*- flycheck-disabled-checkers: (emacs-lisp-checkdoc) -*-
(load (concat (file-name-directory (or load-file-name (buffer-file-name)
                                       default-directory))
              "utils.el") nil 'nomessage 'nosuffix)



(defun expect-filled-as (strs etalon)
  (expect
   (lua-buffer-strs
    (let ((fill-column 10))
      (lua-insert-goto-<>
       strs)
      (execute-kbd-macro (kbd "M-q"))))
   :to-equal
   etalon))



(describe "Test fill-paragraph"
  (it "filling single-line comment"
    (expect-filled-as '("<>-- foo bar baz qux")
                      '("-- foo bar"
                        "-- baz qux")))
  (it "filling comment after code"
    (expect-filled-as '("<>foo -- bar baz")
                      '("foo -- bar"
                        "    -- baz")))
  (xit "filling multiline comment"
    (expect-filled-as '("<>--[[ foo bar baz ]]")
                      '("--[[ foo bar"
                        "     baz ]]")))
  (it "does not spill comments into code (issue #25)"
    (expect-filled-as '("<>"
                        "-- foo bar baz qux"
                        "foo_func()")
                      '(""
                        "-- foo bar"
                        "-- baz qux"
                        "foo_func()"))))