Fix failing tests
[org-mode.git] / testing / lisp / test-org-info.el
blobdf0ef31959f9f473ab71bb87c2e064b4bb91771d
1 ;;; test-org-info.el --- Tests for "org-info.el" -*- lexical-binding: t; -*-
3 ;; Copyright (C) 2017 Nicolas Goaziou
5 ;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
7 ;; This program is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation, either version 3 of the License, or
10 ;; (at your option) any later version.
12 ;; This program is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ;;; Code:
22 (ert-deftest test-org-info/export ()
23 "Test `org-info-export' specifications."
24 ;; Regular export to HTML, with node. Without node, refer to "Top".
25 (should
26 (equal (org-info-export "filename#node" nil 'html)
27 "<a href=\"filename.html#node\">filename#node</a>"))
28 (should
29 (equal (org-info-export "filename" nil 'html)
30 "<a href=\"filename.html#Top\">filename</a>"))
31 ;; When exporting to HTML, ensure node names are expanded according
32 ;; to (info "(texinfo) HTML Xref Node Name Expansion").
33 (should
34 (equal "_005f"
35 (let ((name (org-info-export "#_" nil 'html)))
36 (and (string-match "#\\(.*\\)\"" name)
37 (match-string 1 name)))))
38 (should
39 (equal "_002d"
40 (let ((name (org-info-export "#-" nil 'html)))
41 (and (string-match "#\\(.*\\)\"" name)
42 (match-string 1 name)))))
43 (should
44 (equal "A-node"
45 (let ((name (org-info-export "#A node" nil 'html)))
46 (and (string-match "#\\(.*\\)\"" name)
47 (match-string 1 name)))))
48 (should
49 (equal "A-node-_002d_002d_002d-with-_005f_0027_0025"
50 (let ((name (org-info-export "#A node --- with _'%" nil 'html)))
51 (and (string-match "#\\(.*\\)\"" name)
52 (match-string 1 name))))))
56 (provide 'test-org-info)
57 ;;; test-org-info.el ends here