Browse Source

org-element: Add tests

* testing/lisp/test-org-element.el: Add tests.
Nicolas Goaziou 12 years ago
parent
commit
f1bb17549b
1 changed files with 19 additions and 1 deletions
  1. 19 1
      testing/lisp/test-org-element.el

+ 19 - 1
testing/lisp/test-org-element.el

@@ -1260,7 +1260,25 @@ e^{i\\pi}+1=0
   ;; 4. Angular link.
   (should
    (org-test-with-temp-text "A link: <http://orgmode.org>"
-     (org-element-map (org-element-parse-buffer) 'link 'identity nil t))))
+     (org-element-map (org-element-parse-buffer) 'link 'identity nil t)))
+  ;; Link abbreviation.
+  (should
+   (equal "http"
+	  (org-test-with-temp-text
+	      "#+LINK: orgmode http://www.orgmode.org/\n[[orgmode:#docs]]"
+	    (progn (org-mode-restart)
+		   (goto-char (point-max))
+		   (org-element-property :type (org-element-context))))))
+  ;; Link abbreviation in a secondary string.
+  (should
+   (equal "http"
+	  (org-test-with-temp-text
+	      "#+LINK: orgmode http://www.orgmode.org/\n* H [[orgmode:#docs]]"
+	    (progn (org-mode-restart)
+		   (org-element-map
+		    (org-element-parse-buffer) 'link
+		    (lambda (link) (org-element-property :type link))
+		    nil t nil t))))))
 
 
 ;;;; Macro