summaryrefslogtreecommitdiff
path: root/bog-tests.el
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-02-05 01:51:45 -0500
committerKyle Meyer <kyle@kyleam.com>2014-02-06 00:46:47 -0500
commitf4b7bea779a3a4ea1e07d5d98c917a6c79f7a1ea (patch)
tree5d93f4b087b5eafacedecd16f1fbc59e489ef89b /bog-tests.el
parenta0057df8ddc056bc22382f653b7fa046f9430ff0 (diff)
downloadbog-f4b7bea779a3a4ea1e07d5d98c917a6c79f7a1ea.tar.gz
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.
Diffstat (limited to 'bog-tests.el')
-rw-r--r--bog-tests.el36
1 files changed, 30 insertions, 6 deletions
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"))