|
@@ -65,44 +65,150 @@
|
|
|
(should-not (file-exists-p (concat org-test-link-in-heading-file "::")))
|
|
|
(when (file-exists-p html-file) (delete-file html-file))))
|
|
|
|
|
|
-;; TODO
|
|
|
-;; (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"
|
|
|
-;; (let (html)
|
|
|
-;; (org-test-at-id "eb1f6498-5bd9-45e0-9c56-50717053e7b7"
|
|
|
-;; (org-narrow-to-subtree)
|
|
|
-;; (let ((arg nil)
|
|
|
-;; )
|
|
|
-;; (mapcar (lambda (x)
|
|
|
-;; (should (equal ""
|
|
|
-;; (org-export-as-html nil
|
|
|
-;; nil
|
|
|
-;; nil
|
|
|
-;; 'string))))
|
|
|
-;; '("yes" "no" "tangle"))))))
|
|
|
-
|
|
|
-
|
|
|
-;; TODO Test broken (args-out-of-range 1927 3462)
|
|
|
-;; (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."
|
|
|
-;; (let (html)
|
|
|
-;; (org-test-at-id "92518f2a-a46a-4205-a3ab-bcce1008a4bb"
|
|
|
-;; (org-narrow-to-subtree)
|
|
|
-;; (setq html (org-export-as-html nil nil nil 'string))
|
|
|
-;; (should (string-match "<pre.*>[^\000]*</pre>" html))
|
|
|
-;; (should (string-match "<table.*>[^\000]*</table>" html)))))
|
|
|
-
|
|
|
-;; TODO Test Broken - causes ert to go off into the weeds
|
|
|
-;; (ert-deftest ob-exp/export-subtree ()
|
|
|
-;; (org-test-at-id "5daa4d03-e3ea-46b7-b093-62c1b7632df3"
|
|
|
-;; (org-mark-subtree)
|
|
|
-;; (org-export-as-latex nil)))
|
|
|
+(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))
|
|
|
+ (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)))
|
|
|
+ '("<head>" "</head>" "<body>"
|
|
|
+ "<code>:noweb</code> header argument expansion"
|
|
|
+ "<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>>"
|
|
|
+ "</body>"))))))
|
|
|
+
|
|
|
+(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))
|
|
|
+ (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)))
|
|
|
+ '("<head>" "</head>" "<body>"
|
|
|
+ "<code>:noweb</code> header argument expansion using :exports results"
|
|
|
+ "<code>:noweb</code> header argument expansion using :exports results"
|
|
|
+ "expanded1"
|
|
|
+ "expanded2"
|
|
|
+ "expanded1"
|
|
|
+ "noweb-no-start"
|
|
|
+ "<<noweb-example1>>"
|
|
|
+ "expanded2"
|
|
|
+ "<<noweb-example1>>"
|
|
|
+ "<<noweb-example2>>"
|
|
|
+ "</body>"))))))
|
|
|
+
|
|
|
+(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))
|
|
|
+ (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)))
|
|
|
+ '("<head>" "</head>" "<body>"
|
|
|
+ "Pascal's Triangle – exports both test"
|
|
|
+ "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>"
|
|
|
+ "</body>"))))))
|
|
|
+
|
|
|
+(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))
|
|
|
+ (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)))
|
|
|
+ '("<head>" "</head>" "<body>"
|
|
|
+ "mixed blocks with exports both"
|
|
|
+ "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>"
|
|
|
+ "</body>"))))))
|
|
|
+
|
|
|
(provide 'test-ob-exp)
|
|
|
|
|
|
;;; test-ob-exp.el ends here
|
|
|
+
|