From f4b7bea779a3a4ea1e07d5d98c917a6c79f7a1ea Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Wed, 5 Feb 2014 01:51:45 -0500 Subject: ENH: Allow citekeys to be properties Now citekeys can be taken either from properties or from headings. This provides greater compatibility with org-bibtex.el. --- bog-tests.el | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'bog-tests.el') diff --git a/bog-tests.el b/bog-tests.el index d2a3894..822238a 100644 --- a/bog-tests.el +++ b/bog-tests.el @@ -74,17 +74,41 @@ (re-search-backward bog-citekey-format) (should (equal (bog-citekey-from-heading-title) citekey))))) -;; `bog-citekey-action' +;; `bog-citekey-from-property' -(ert-deftest bog-citekey-action-in-normal-text () +(ert-deftest bog-citekey-from-property-current-level () (let ((citekey "name2010word")) (with-temp-buffer - (insert (format "\n* top level\n\n** %s\n\nsome text\n" - citekey)) + (insert "\n* top level\n\n** subhead\n" + (format ":PROPERTIES:\n:CUSTOM_ID: %s\n" citekey) + ":END:\nsome text\n") (org-mode) (show-all) - (flet ((funcall (action citekey) citekey)) - (should (equal (bog-citekey-action nil nil nil) citekey)))))) + (should (equal (bog-citekey-from-property) citekey))))) + +(ert-deftest bog-citekey-from-property-in-parent () + (let ((citekey "name2010word")) + (with-temp-buffer + (insert "\n* top level\n" + (format ":PROPERTIES:\n:CUSTOM_ID: %s\n" citekey) + ":END:\nsome text\n" + "** subhead\n\n") + (org-mode) + (show-all) + (should (equal (bog-citekey-from-property) citekey))))) + +(ert-deftest bog-citekey-from-property-on-heading () + (let ((citekey "name2010word")) + (with-temp-buffer + (insert "\n* top level\n\n** subhead\n" + (format ":PROPERTIES:\n:CUSTOM_ID: %s\n" citekey) + ":END:\nsome text\n") + (org-mode) + (show-all) + (org-back-to-heading) + (should (equal (bog-citekey-from-property) citekey))))) + +;; `bog-citekey-action' (ert-deftest bog-citekey-action-on-heading () (let ((citekey "name2010word")) -- cgit v1.2.3