summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2013-02-18 08:58:59 +0100
committerNicolas Goaziou <n.goaziou@gmail.com>2013-02-18 08:58:59 +0100
commita385c6e0e43b0127c49a1552ae6313a7a392dc83 (patch)
tree223b5f473a6c1108c563419f07cf43b716e95fd3
parentaf9191d18b3c8224fc48661bc5831b3b06944f4c (diff)
downloadorg-mode-a385c6e0e43b0127c49a1552ae6313a7a392dc83.tar.gz
org-element: Fix docstring, add tests
* lisp/org-element.el (org-element-headline-parser, org-element-inlinetask-parser): Fix docstring. * testing/lisp/test-org-element.el: Add tests. This follows ae5932282d44742d932d40136edf441bc18609a9.
-rw-r--r--lisp/org-element.el8
-rw-r--r--testing/lisp/test-org-element.el41
2 files changed, 39 insertions, 10 deletions
diff --git a/lisp/org-element.el b/lisp/org-element.el
index d00004d..3dc1e72 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -736,8 +736,8 @@ containing `:raw-value', `:title', `:begin', `:end',
`:commentedp' and `:footnote-section-p' keywords.
The plist also contains any property set in the property drawer,
-with its name in lowercase, the underscores replaced with hyphens
-and colons at the beginning (i.e. `:custom-id').
+with its name in upper cases and colons added at the
+beginning (i.e. `:CUSTOM_ID').
When RAW-SECONDARY-P is non-nil, headline's title will not be
parsed as a secondary string, but as a plain string instead.
@@ -912,8 +912,8 @@ containing `:title', `:begin', `:end', `:hiddenp',
`:scheduled', `:deadline', `:closed' and `:post-blank' keywords.
The plist also contains any property set in the property drawer,
-with its name in lowercase, the underscores replaced with hyphens
-and colons at the beginning (i.e. `:custom-id').
+with its name in upper cases and colons added at the
+beginning (i.e. `:CUSTOM_ID').
When optional argument RAW-SECONDARY-P is non-nil, inline-task's
title will not be parsed as a secondary string, but as a plain
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index 902198a..a65355f 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -874,6 +874,17 @@ Some other text
;; Test tag removal.
(should (equal (org-element-property :tags headline) '("test")))))))
+(ert-deftest test-org-element/headline-properties ()
+ "Test properties from property drawer."
+ ;; All properties from property drawer have their symbol upper
+ ;; cased.
+ (should
+ (org-test-with-temp-text "* Headline\n:PROPERTIES:\n:foo: bar\n:END:"
+ (org-element-property :FOO (org-element-at-point))))
+ (should-not
+ (org-test-with-temp-text "* Headline\n:PROPERTIES:\n:foo: bar\n:END:"
+ (org-element-property :foo (org-element-at-point)))))
+
;;;; Horizontal Rule
@@ -943,8 +954,8 @@ Some other text
(org-test-with-temp-text "*************** TODO Task"
(org-element-property
:todo-keyword
- (org-element-map
- (org-element-parse-buffer) 'inlinetask 'identity nil t))))))
+ (org-element-map (org-element-parse-buffer) 'inlinetask
+ 'identity nil t))))))
;; Planning info.
(should
(equal
@@ -954,8 +965,7 @@ Some other text
DEADLINE: <2012-03-29 thu.>"
(org-element-property
:deadline
- (org-element-map
- (org-element-parse-buffer) 'inlinetask 'identity nil t)))))
+ (org-element-map (org-element-parse-buffer) 'inlinetask 'identity nil t)))))
;; Priority.
(should
(equal
@@ -965,7 +975,7 @@ DEADLINE: <2012-03-29 thu.>"
(org-element-property
:priority
(org-element-map
- (org-element-parse-buffer) 'inlinetask 'identity nil t)))))
+ (org-element-parse-buffer) 'inlinetask 'identity nil t)))))
;; Tags.
(should
(equal
@@ -975,7 +985,26 @@ DEADLINE: <2012-03-29 thu.>"
(org-element-property
:tags
(org-element-map
- (org-element-parse-buffer) 'inlinetask 'identity nil t))))))))
+ (org-element-parse-buffer) 'inlinetask 'identity nil t)))))
+ ;; Regular properties are accessed through upper case keywords.
+ (should
+ (org-test-with-temp-text "
+*************** Task
+:PROPERTIES:
+:foo: bar
+:END:
+*************** END"
+ (forward-line)
+ (org-element-property :FOO (org-element-at-point))))
+ (should-not
+ (org-test-with-temp-text "
+*************** Task
+:PROPERTIES:
+:foo: bar
+:END:
+*************** END"
+ (forward-line)
+ (org-element-property :foo (org-element-at-point)))))))
;;;; Italic