Add tests for broken links handling

* testing/lisp/test-ox.el (test-org-export/handle-options): Add tests.
This commit is contained in:
Nicolas Goaziou 2015-10-18 23:02:15 +02:00
parent c2eeaca0ca
commit 9f18368311
1 changed files with 30 additions and 0 deletions

View File

@ -473,6 +473,36 @@ Paragraph"
(let ((org-archive-tag "archive")) (let ((org-archive-tag "archive"))
(org-export-as (org-test-default-backend) (org-export-as (org-test-default-backend)
nil nil nil '(:with-archived-trees t)))))) nil nil nil '(:with-archived-trees t))))))
;; Broken links. Depending on `org-export-with-broken-links', raise
;; an error, ignore link or mark is as broken in output.
(should-error
(org-test-with-temp-text "[[#broken][link]]"
(let ((backend
(org-export-create-backend
:transcoders
'((section . (lambda (_e c _i) c))
(paragraph . (lambda (_e c _i) c))
(link . (lambda (l c i) (org-export-resolve-id-link l i)))))))
(org-export-as backend nil nil nil '(:with-broken-links nil)))))
(should
(org-test-with-temp-text "[[#broken][link]]"
(let ((backend
(org-export-create-backend
:transcoders
'((section . (lambda (_e c _i) c))
(paragraph . (lambda (_e c _i) c))
(link . (lambda (l c i) (org-export-resolve-id-link l i)))))))
(org-export-as backend nil nil nil '(:with-broken-links t)))))
(should
(org-test-with-temp-text "[[#broken][link]]"
(let ((backend
(org-export-create-backend
:transcoders
'((section . (lambda (_e c _i) c))
(paragraph . (lambda (_e c _i) c))
(link . (lambda (l c i) (org-export-resolve-id-link l i)))))))
(org-string-nw-p
(org-export-as backend nil nil nil '(:with-broken-links mark))))))
;; Clocks. ;; Clocks.
(should (should
(string-match "CLOCK: \\[2012-04-29 .* 10:45\\]" (string-match "CLOCK: \\[2012-04-29 .* 10:45\\]"