1 ;; Tests for operations on toc
3 (add-to-list 'load-path
".")
7 (ert-deftest toc-asserts
()
8 "Check some assertions."
9 (should (equal ert-Buf-point-char
"\^@"))
10 (should (equal ert-Buf-mark-char
"\^?"))
13 (ert-deftest rst-toc-insert
()
14 "Tests `rst-toc-insert'."
37 ;; Set customizable variables to defaults
38 (let ((rst-toc-indent 2)
39 (rst-toc-insert-style 'fixed
)
40 (rst-toc-insert-number-separator " ")
41 (rst-toc-insert-max-level nil
))
42 ;; Can't identify a title so do nothing - that's actually a (MIS-)FEATURE
43 (should (ert-equal-buffer
45 (concat "\^@" headers
)
47 ;; Won't work on a section title
48 (should (ert-equal-buffer
50 (concat title
"\^@" headers
)
53 (should (ert-equal-buffer
55 (concat title
"\^@\n\n" headers
)
56 (concat title
"1 Header A
59 2.1.1 SubSubheader B.a.1
65 (should (ert-equal-buffer
67 (concat title
" \^@\n\n" headers
)
68 (concat title
" 1 Header A
71 2.1.1 SubSubheader B.a.1
77 (should (ert-equal-buffer
79 (concat title
" \^@\n\n" headers
)
80 (concat title
" 1 Header A
85 ;; Prefix and indentation
86 (should (ert-equal-buffer
88 (concat title
".. \^@\n\n" headers
)
89 (concat title
".. 1 Header A
92 2.1.1 SubSubheader B.a.1
100 (ert-deftest rst-toc-update
()
101 "Tests `rst-toc-update'."
124 (contents ".. contents:: Inhalt\n")
125 (fields " :bla: blub\n :local:\n")
133 2.1.1 SubSubheader B.a.1
137 ;; Set customizable variables to defaults
138 (let ((rst-toc-indent 2)
139 (rst-toc-insert-style 'fixed
)
140 (rst-toc-insert-number-separator " ")
141 (rst-toc-insert-max-level nil
))
142 (should (ert-equal-buffer
144 (concat title contents fields old
"\n\n" headers
"\^@")
145 (concat title contents fields new
"\n\n" headers
"\^@")))
146 (should (ert-equal-buffer
148 (concat title contents old
"\n\n" headers
"\^@")
149 (concat title contents new
"\n\n" headers
"\^@")))
153 ;; FIXME: More functions to test:
155 ;; * rst-toc-mode-goto-section