From 9f18368311d8cf752356d91cfa0e6d478ba214eb Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sun, 18 Oct 2015 23:02:15 +0200 Subject: [PATCH] Add tests for broken links handling * testing/lisp/test-ox.el (test-org-export/handle-options): Add tests. --- testing/lisp/test-ox.el | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el index 57859841c..d619ec8f0 100644 --- a/testing/lisp/test-ox.el +++ b/testing/lisp/test-ox.el @@ -473,6 +473,36 @@ Paragraph" (let ((org-archive-tag "archive")) (org-export-as (org-test-default-backend) 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. (should (string-match "CLOCK: \\[2012-04-29 .* 10:45\\]"