summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-01-21 13:56:58 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-01-21 13:56:58 +0100
commit2950be040db8bb91a40bc79633f8654ae58e190a (patch)
tree44a31242da574f61a6c5f5e5e5fd70e54d9bddbb
parent9a952ab18a45adb5dce4cacf1b3e6cc8fac77eb6 (diff)
downloadorg-mode-2950be040db8bb91a40bc79633f8654ae58e190a.tar.gz
org-info: Add tests
* testing/lisp/test-org-info.el: New file.
-rw-r--r--testing/lisp/test-org-info.el57
1 files changed, 57 insertions, 0 deletions
diff --git a/testing/lisp/test-org-info.el b/testing/lisp/test-org-info.el
new file mode 100644
index 0000000..df0ef31
--- /dev/null
+++ b/testing/lisp/test-org-info.el
@@ -0,0 +1,57 @@
+;;; test-org-info.el --- Tests for "org-info.el" -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2017 Nicolas Goaziou
+
+;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(ert-deftest test-org-info/export ()
+ "Test `org-info-export' specifications."
+ ;; Regular export to HTML, with node. Without node, refer to "Top".
+ (should
+ (equal (org-info-export "filename#node" nil 'html)
+ "<a href=\"filename.html#node\">filename#node</a>"))
+ (should
+ (equal (org-info-export "filename" nil 'html)
+ "<a href=\"filename.html#Top\">filename</a>"))
+ ;; When exporting to HTML, ensure node names are expanded according
+ ;; to (info "(texinfo) HTML Xref Node Name Expansion").
+ (should
+ (equal "_005f"
+ (let ((name (org-info-export "#_" nil 'html)))
+ (and (string-match "#\\(.*\\)\"" name)
+ (match-string 1 name)))))
+ (should
+ (equal "_002d"
+ (let ((name (org-info-export "#-" nil 'html)))
+ (and (string-match "#\\(.*\\)\"" name)
+ (match-string 1 name)))))
+ (should
+ (equal "A-node"
+ (let ((name (org-info-export "#A node" nil 'html)))
+ (and (string-match "#\\(.*\\)\"" name)
+ (match-string 1 name)))))
+ (should
+ (equal "A-node-_002d_002d_002d-with-_005f_0027_0025"
+ (let ((name (org-info-export "#A node --- with _'%" nil 'html)))
+ (and (string-match "#\\(.*\\)\"" name)
+ (match-string 1 name))))))
+
+
+
+(provide 'test-org-info)
+;;; test-org-info.el ends here