1 ;; Tests for `rst-all-stn' and relatives -*- lexical-binding: t -*-
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-all-stn
()
14 "Tests `rst-all-stn'."
38 (ado-T (rst-Ado-new-over-and-under ?
=))
39 (ttl-T (rst-Ttl--new ado-T
'(1 18 1 6 7 12 13 18) 0
41 (ado-A (rst-Ado-new-simple ?
=))
42 (ttl-A (rst-Ttl--new ado-A
'(20 37 nil nil
20 28 29 37) 0
44 (ttl-B (rst-Ttl--new ado-A
'(39 56 nil nil
39 47 48 56) 0
46 (ado-Ba (rst-Ado-new-simple ?-
))
47 (ttl-Ba (rst-Ttl--new ado-Ba
'(58 85 nil nil
58 71 72 85) 0
49 (ado-Ba1 (rst-Ado-new-simple ?~
))
50 (ttl-Ba1 (rst-Ttl--new ado-Ba1
'(87 124 nil nil
87 105 106 124) 0
51 "SubSubheader B.a.1"))
52 (ttl-C (rst-Ttl--new ado-A
'(126 143 nil nil
126 134 135 143) 0
55 (ttl-Ca1 (rst-Ttl--new ado-Ba1
'(145 182 nil nil
145 163 164 182) 0
56 "Missing node C.a.1")))
57 (let* ((stn-Ca (rst-Stn-new
59 (list (rst-Stn-new ttl-Ca1
3 nil
))))
63 (stn-A (rst-Stn-new ttl-A
1 nil
))
68 (list (rst-Stn-new ttl-Ba1
3 nil
))))))
74 (should (ert-equal-buffer-return
80 (should (ert-equal-buffer-return
86 (list (rst-Stn-new ttl-T
0 nil
)))
88 (should (ert-equal-buffer-return
90 (concat title headers
)
98 (ert-deftest rst-stn-containing-point
()
99 "Tests `rst-stn-containing-point'."
114 ;; SubSubheader B.a.1
115 ;; ~~~~~~~~~~~~~~~~~~
123 ;; Missing node C.a.1
124 ;; ~~~~~~~~~~~~~~~~~~
131 (ado-T (rst-Ado-new-over-and-under ?
=))
132 (ttl-T (rst-Ttl--new ado-T
'(1 18 1 6 7 12 13 18) 0
134 (ado-A (rst-Ado-new-simple ?
=))
135 (ttl-A (rst-Ttl--new ado-A
'(20 37 nil nil
20 28 29 37) 0
137 (ttl-B (rst-Ttl--new ado-A
'(39 56 nil nil
39 47 48 56) 0
139 (ado-Ba (rst-Ado-new-simple ?-
))
140 (ttl-Ba (rst-Ttl--new ado-Ba
'(58 85 nil nil
58 71 72 85) 0
142 (ado-Ba1 (rst-Ado-new-simple ?~
))
143 (ttl-Ba1 (rst-Ttl--new ado-Ba1
'(87 124 nil nil
87 105 106 124) 0
144 "SubSubheader B.a.1"))
145 (ttl-Bb (rst-Ttl--new ado-Ba
'(126 153 nil nil
126 139 140 153) 0
147 (ttl-C (rst-Ttl--new ado-A
'(155 172 nil nil
155 163 164 172) 0
150 (ttl-Ca1 (rst-Ttl--new ado-Ba1
'(164 211 nil nil
164 192 193 211) 0
151 "Missing node C.a.1")))
152 (let* ((stn-Ca (rst-Stn-new
154 (list (rst-Stn-new ttl-Ca1
3 nil
))))
158 (stn-A (rst-Stn-new ttl-A
1 nil
))
161 (list (rst-Stn-new ttl-Ba1
3 nil
))))
162 (stn-Bb (rst-Stn-new ttl-Bb
2 nil
))
172 (should (ert-equal-buffer-return
173 '(rst-stn-containing-point (rst-all-stn))
178 (should (ert-equal-buffer-return
179 '(rst-stn-containing-point (rst-all-stn))
184 (should (ert-equal-buffer-return
185 '(rst-stn-containing-point (rst-all-stn))
188 (rst-Stn-new ttl-T
0 nil
)
190 (should (ert-equal-buffer-return
191 '(rst-stn-containing-point (rst-all-stn))
192 (concat title
"\^@Header A
212 (should (ert-equal-buffer-return
213 '(rst-stn-containing-point (rst-all-stn))
214 (concat title
"Header A
234 (should (ert-equal-buffer-return
235 '(rst-stn-containing-point (rst-all-stn))
236 (concat title
"Header A
256 (should (ert-equal-buffer-return
257 '(rst-stn-containing-point (rst-all-stn))
258 (concat title
"Header A