1 ;; Tests for `rst-section-tree'
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
"\^?"))
14 "Replace all markers in OBJ by integers and return result."
17 (marker-position obj
))
21 (mapcar 'mrk2int obj
))
24 (defun section-tree ()
25 "Return result of `rst-section-tree' with markers replaced by integers."
26 (mrk2int (rst-section-tree)))
28 (defun section-tree-point ()
29 "Return result of `rst-section-tree-point' with markers replaced by integers."
30 (mrk2int (rst-section-tree-point (rst-section-tree))))
32 (ert-deftest rst-section-tree
()
33 "Tests `rst-section-tree'."
56 (should (ert-equal-buffer-return
62 (should (ert-equal-buffer-return
66 '((nil 7) (("Title" 7)))
68 (should (ert-equal-buffer-return
70 (concat title headers
)
77 (("SubSubheader B.a.1" 87)))
78 (("Subheader B.b" 126)))
83 (ert-deftest rst-section-tree-point
()
84 "Tests `rst-section-tree-point'."
90 (should (ert-equal-buffer-return
96 (should (ert-equal-buffer-return
102 (should (ert-equal-buffer-return
106 '(((nil 7) ("Title" 7)) ("Title" 7))
108 (should (ert-equal-buffer-return
110 (concat title
"\^@Header A
128 '(((nil 7) ("Title" 7) ("Header A" 20)) ("Header A" 20))
130 (should (ert-equal-buffer-return
132 (concat title
"Header A
150 '(((nil 7) ("Title" 7) ("Header B" 39)) ("Header B" 39)
151 (("Subheader B.a" 58)
152 (("SubSubheader B.a.1" 87)))
153 (("Subheader B.b" 126)))
155 (should (ert-equal-buffer-return
157 (concat title
"Header A
175 '(((nil 7) ("Title" 7) ("Header B" 39) ("Subheader B.a" 58))
177 (("SubSubheader B.a.1" 87)))
179 (should (ert-equal-buffer-return
181 (concat title
"Header A
199 '(((nil 7) ("Title" 7) ("Header B" 39) ("Subheader B.b" 126))
200 ("Subheader B.b" 126))