blob f86d84ae336f940f5096007fad8a65e43a75ab68 9154 bytes (raw)
name: testing/lisp/test-ob-exp.el # note: path name is non-authoritative(*)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
| | ;;; test-ob-exp.el
;; Copyright (c) 2010-2012 Eric Schulte
;; Authors: Eric Schulte
;; Released under the GNU General Public License version 3
;; see: http://www.gnu.org/licenses/gpl-3.0.html
;;;; Comments:
;; Template test file for Org-mode tests
;;; Code:
(ert-deftest test-ob-exp/org-babel-exp-src-blocks/w-no-headers ()
"Testing export without any headlines in the org-mode file."
(let ((html-file (concat (file-name-sans-extension org-test-no-heading-file)
".html")))
(when (file-exists-p html-file) (delete-file html-file))
(org-test-in-example-file org-test-no-heading-file
;; export the file to html
(org-export-as-html nil))
;; should create a .html file
(should (file-exists-p html-file))
;; should not create a file with "::" appended to it's name
(should-not (file-exists-p (concat org-test-no-heading-file "::")))
(when (file-exists-p html-file) (delete-file html-file))))
(ert-deftest test-ob-exp/org-babel-exp-src-blocks/w-no-file ()
"Testing export from buffers which are not visiting any file."
(when (get-buffer "*Org HTML Export*") (kill-buffer "*Org HTML Export*"))
(should-not (get-buffer "*Org HTML Export*"))
;; export the file to HTML in a temporary buffer
(org-test-in-example-file nil (org-export-as-html-to-buffer nil))
;; should create a .html buffer
(should (buffer-live-p (get-buffer "*Org HTML Export*")))
;; should contain the content of the buffer
(save-excursion
(set-buffer (get-buffer "*Org HTML Export*"))
(should (string-match (regexp-quote org-test-file-ob-anchor)
(buffer-string))))
(when (get-buffer "*Org HTML Export*") (kill-buffer "*Org HTML Export*")))
(ert-deftest test-ob-exp/org-babel-exp-src-blocks/w-no-headers2 ()
"Testing export without any headlines in the org-mode file."
(let ((html-file (concat (file-name-sans-extension
org-test-link-in-heading-file)
".html")))
(when (file-exists-p html-file) (delete-file html-file))
(org-test-in-example-file org-test-link-in-heading-file
;; export the file to html
(org-export-as-html nil))
;; should create a .html file
(should (file-exists-p html-file))
;; should not create a file with "::" appended to it's name
(should-not (file-exists-p (concat org-test-link-in-heading-file "::")))
(when (file-exists-p html-file) (delete-file html-file))))
(ert-deftest ob-exp/noweb-on-export ()
"Noweb header arguments export correctly.
- yes expand on both export and tangle
- no expand on neither export or tangle
- tangle expand on only tangle not export"
(org-test-at-id "eb1f6498-5bd9-45e0-9c56-50717053e7b7"
(org-narrow-to-subtree)
(let ((exported-html
(org-export-as-html nil nil nil 'string 'body-only))
(test-point 0))
(org-test-with-temp-text-in-file
exported-html
;; check following ouput exists and in order
(mapcar (lambda (x)
(should (< test-point
(re-search-forward
x
nil t)))
(setq test-point (point)))
'("<code>:noweb</code> header argument expansion"
"message" "expanded1"
"message" "expanded2"
"noweb-1-yes-start"
"message" "expanded1"
"noweb-no-start"
"<<noweb-example1>>"
"noweb-2-yes-start"
"message" "expanded2"
"noweb-tangle-start"
"<<noweb-example1>>"
"<<noweb-example2>>"))))))
(ert-deftest ob-exp/noweb-on-export-with-exports-results ()
"Noweb header arguments export correctly using :exports results.
- yes expand on both export and tangle
- no expand on neither export or tangle
- tangle expand on only tangle not export"
(org-test-at-id "8701beb4-13d9-468c-997a-8e63e8b66f8d"
(org-narrow-to-subtree)
(let ((exported-html
(org-export-as-html nil nil nil 'string 'body-only))
(test-point 0))
(org-test-with-temp-text-in-file
exported-html
;; check following ouput exists and in order
(mapcar (lambda (x)
(should (< test-point
(re-search-forward
x
nil t)))
(setq test-point (point)))
'("<code>:noweb</code> header argument expansion using :exports results"
"expanded1"
"expanded2"
"expanded1"
"noweb-no-start"
"<<noweb-example1>>"
"expanded2"
"<<noweb-example1>>"
"<<noweb-example2>>"))))))
(ert-deftest ob-exp/exports-both ()
"Test the :exports both header argument.
The code block should create both <pre></pre> and <table></table>
elements in the final html."
(org-test-at-id "92518f2a-a46a-4205-a3ab-bcce1008a4bb"
(org-narrow-to-subtree)
(let ((exported-html
(org-export-as-html nil nil nil 'string 'body-only))
(test-point 0))
(org-test-with-temp-text-in-file
exported-html
;; check following ouput exists and in order
(mapcar (lambda (x)
(should (< test-point
(re-search-forward
x
nil t)))
(setq test-point (point)))
'( "Pascal's Triangle – exports both test"
"<pre"
"defun" "pascals-triangle"
"if""list""list""let*""prev-triangle"
"pascals-triangle""prev-row""car""reverse""prev-triangle"
"append""prev-triangle""list""map""list"
"append""prev-row""append""prev-row""pascals-triangle"
"</pre>"
"<table""<tbody>"
"<tr>"">1<""</tr>"
"<tr>"">1<"">1<""</tr>"
"<tr>"">1<"">2<"">1<""</tr>"
"<tr>"">1<"">3<"">3<"">1<""</tr>"
"<tr>"">1<"">4<"">6<"">4<"">1<""</tr>"
"<tr>"">1<"">5<"">10<"">10<"">5<"">1<""</tr>"
"</tbody>""</table>"))))))
(ert-deftest ob-exp/mixed-blocks-with-exports-both ()
(org-test-at-id "5daa4d03-e3ea-46b7-b093-62c1b7632df3"
(org-narrow-to-subtree)
(let ((exported-html
(org-export-as-html nil nil nil 'string 'body-only))
(test-point 0))
(org-test-with-temp-text-in-file
exported-html
;; check following ouput exists and in order
(mapcar (lambda (x)
(should (< test-point
(re-search-forward
x
nil t)))
(setq test-point (point)))
'("mixed blocks with exports both"
"<ul>"
"<li>""a""</li>"
"<li>""b""</li>"
"<li>""c""</li>"
"</ul>"
"<pre"
"\"code block results\""
"</pre>"
"<pre class=\"example\">"
"code block results"
"</pre>"))))))
(ert-deftest ob-exp/export-with-name ()
(let ((org-babel-exp-code-template
"=%name=\n#+BEGIN_SRC %lang%flags\nbody\n#+END_SRC"))
(org-test-at-id "b02ddd8a-eeb8-42ab-8664-8a759e6f43d9"
(org-narrow-to-subtree)
(let ((ascii (org-export-as-ascii nil nil nil 'string 'body-only)))
(should (string-match "qux" ascii))))))
(ert-deftest ob-exp/export-with-header-argument ()
(let ((org-babel-exp-code-template
"
| header | value |
|---------+----------|
| foo | %foo |
| results | %results |
#+BEGIN_SRC %lang%flags\nbody\n#+END_SRC"))
(org-test-at-id "b02ddd8a-eeb8-42ab-8664-8a759e6f43d9"
(org-narrow-to-subtree)
(let ((ascii (org-export-as-ascii nil nil nil 'string 'body-only)))
(should (string-match "baz" ascii))
(should (string-match "replace" ascii))))))
(ert-deftest ob-exp/noweb-no-export-and-exports-both ()
(org-test-at-id "8a820f6c-7980-43db-8a24-0710d33729c9"
(org-narrow-to-subtree)
(let ((html (org-export-as-html nil nil nil 'string 'body-only)))
(should (string-match (regexp-quote "noweb-no-export-and-exports-both-1")
html)))))
(ert-deftest ob-exp/evaluate-all-executables-in-order ()
(org-test-at-id "96cc7073-97ec-4556-87cf-1f9bffafd317"
(org-narrow-to-subtree)
(let (*evaluation-collector*)
(org-export-as-ascii nil nil nil 'string)
(should (equal '(5 4 3 2 1) *evaluation-collector*)))))
(ert-deftest ob-exp/export-call-line-information ()
(org-test-at-id "bec63a04-491e-4caa-97f5-108f3020365c"
(org-narrow-to-subtree)
(let* ((org-babel-exp-call-line-template "\n: call: %line special-token")
(html (org-export-as-html nil nil nil 'string t)))
(should (string-match "double" html))
(should (string-match "16" html))
(should (string-match "special-token" html)))))
(ert-deftest ob-exp/noweb-strip-export-ensure-strips ()
(org-test-at-id "8e7bd234-99b2-4b14-8cd6-53945e409775"
(org-narrow-to-subtree)
(org-babel-next-src-block 2)
(should (= 110 (org-babel-execute-src-block)))
(let ((ascii (org-export-as-ascii nil nil nil 'string t)))
(should-not (string-match (regexp-quote "<<strip-export-1>>") ascii))
(should-not (string-match (regexp-quote "i=\"10\"") ascii)))))
(ert-deftest ob-exp/export-from-a-temp-buffer ()
:expected-result :failed
(org-test-with-temp-text
"
#+Title: exporting from a temporary buffer
#+name: foo
#+BEGIN_SRC emacs-lisp
:foo
#+END_SRC
#+name: bar
#+BEGIN_SRC emacs-lisp
:bar
#+END_SRC
#+BEGIN_SRC emacs-lisp :var foo=foo :noweb yes :exports results
(list foo <<bar>>)
#+END_SRC
"
(let* ((org-current-export-file (current-buffer))
(ascii (org-export-as-ascii nil nil nil 'string)))
(should (string-match (regexp-quote (format nil "%S" '(:foo :bar)))
ascii)))))
(provide 'test-ob-exp)
;;; test-ob-exp.el ends here
|
debug log:
solving f86d84ae336f940f5096007fad8a65e43a75ab68 ...
retrying f86d84ae336f940f5096007fad8a65e43a75ab68 as f86d84ae336f940f5096007fad8a65e43a75ab6
retrying f86d84ae336f940f5096007fad8a65e43a75ab6 as f86d84ae336f940f5096007fad8a65e43a75ab
retrying f86d84ae336f940f5096007fad8a65e43a75ab as f86d84ae336f940f5096007fad8a65e43a75a
retrying f86d84ae336f940f5096007fad8a65e43a75a as f86d84ae336f940f5096007fad8a65e43a75
retrying f86d84ae336f940f5096007fad8a65e43a75 as f86d84ae336f940f5096007fad8a65e43a7
retrying f86d84ae336f940f5096007fad8a65e43a7 as f86d84ae336f940f5096007fad8a65e43a
retrying f86d84ae336f940f5096007fad8a65e43a as f86d84ae336f940f5096007fad8a65e43
retrying f86d84ae336f940f5096007fad8a65e43 as f86d84ae336f940f5096007fad8a65e4
retrying f86d84ae336f940f5096007fad8a65e4 as f86d84ae336f940f5096007fad8a65e
retrying f86d84ae336f940f5096007fad8a65e as f86d84ae336f940f5096007fad8a65
retrying f86d84ae336f940f5096007fad8a65 as f86d84ae336f940f5096007fad8a6
retrying f86d84ae336f940f5096007fad8a6 as f86d84ae336f940f5096007fad8a
retrying f86d84ae336f940f5096007fad8a as f86d84ae336f940f5096007fad8
retrying f86d84ae336f940f5096007fad8 as f86d84ae336f940f5096007fad
retrying f86d84ae336f940f5096007fad as f86d84ae336f940f5096007fa
retrying f86d84ae336f940f5096007fa as f86d84ae336f940f5096007f
retrying f86d84ae336f940f5096007f as f86d84ae336f940f5096007
retrying f86d84ae336f940f5096007 as f86d84ae336f940f509600
retrying f86d84ae336f940f509600 as f86d84ae336f940f50960
retrying f86d84ae336f940f50960 as f86d84ae336f940f5096
retrying f86d84ae336f940f5096 as f86d84ae336f940f509
retrying f86d84ae336f940f509 as f86d84ae336f940f50
retrying f86d84ae336f940f50 as f86d84ae336f940f5
retrying f86d84ae336f940f5 as f86d84ae336f940f
retrying f86d84ae336f940f as f86d84ae336f940
retrying f86d84ae336f940 as f86d84ae336f94
retrying f86d84ae336f94 as f86d84ae336f9
retrying f86d84ae336f9 as f86d84ae336f
retrying f86d84ae336f as f86d84ae336
retrying f86d84ae336 as f86d84ae33
retrying f86d84ae33 as f86d84ae3
retrying f86d84ae3 as f86d84ae
retrying f86d84ae as f86d84a
found f86d84a in https://yhetil.org/orgmode/87pqc9harc.fsf@Rainer.invalid/
found 8899e0d in https://git.savannah.gnu.org/cgit/emacs/org-mode.git
preparing index
index prepared:
100644 8899e0d51b68e794b591dbfd4844e91391d3c112 testing/lisp/test-ob-exp.el
applying [1/1] https://yhetil.org/orgmode/87pqc9harc.fsf@Rainer.invalid/
diff --git a/testing/lisp/test-ob-exp.el b/testing/lisp/test-ob-exp.el
index 8899e0d..f86d84a 100644
Checking patch testing/lisp/test-ob-exp.el...
Applied patch testing/lisp/test-ob-exp.el cleanly.
index at:
100644 f86d84ae336f940f5096007fad8a65e43a75ab68 testing/lisp/test-ob-exp.el
(*) Git path names are given by the tree(s) the blob belongs to.
Blobs themselves have no identifier aside from the hash of its contents.^
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).